不要复制过来的,简单点,就是Private Sub Form_Load()和End Sub之间的一段代码怎么写?还请高手帮忙!
这道题我提问了两次,谁会做,两个50分都给他.
我试过了,还是不行啊,我是个菜鸟,能不能帮我看看
QQ464317696
VB中怎样让窗口总在最上层,并且在任务管理器的上层
答案:4 悬赏:0 手机版
解决时间 2021-03-10 04:15
- 提问者网友:放下
- 2021-03-09 20:18
最佳答案
- 五星知识达人网友:洎扰庸人
- 2021-03-09 21:42
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
' 将窗口置于列表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE& = &H1
' 保持窗口大小
Private Const SWP_NOMOVE& = &H2
' 保持窗口位置
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为总在最前
End Sub
楼上的你要记住。设置窗体位于最前设置一次就可以了。那里需要timer控件去设置呢?
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
' 将窗口置于列表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE& = &H1
' 保持窗口大小
Private Const SWP_NOMOVE& = &H2
' 保持窗口位置
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为总在最前
End Sub
楼上的你要记住。设置窗体位于最前设置一次就可以了。那里需要timer控件去设置呢?
全部回答
- 1楼网友:走死在岁月里
- 2021-03-10 00:23
厉害!这也行!
- 2楼网友:山有枢
- 2021-03-09 23:13
我有一个不能再任务管理器的上层,但是可以再其他的程序的上层,不知道可以不可以!
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const DONT_MOVE = 2
Private Const DONT_SIZE = 1
Private Const HWND_TOPMOST = -1
Private Const HWND_BOTTOM = -2
Public Sub StayOnTop(frm As Form, intTop As Integer)
Dim intPutOnTop As Integer
Const State = DONT_MOVE Or DONT_SIZE
If intTop Then
intPutOnTop = HWND_TOPMOST
Else
intPutOnTop = HWND_BOTTOM
End If
SetWindowPos frm.hwnd, intPutOnTop, 0, 0, 0, 0, State
DoEvents
End Sub
Private Sub Form_Load()
StayOnTop Me, True
End Sub
- 3楼网友:掌灯师
- 2021-03-09 22:11
d
d
d
楼上的
你怎么到处抄袭别人的东西啊....冒汗....
代码如下:
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Dim a
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
a = SetWindowPos(Form1.hwnd, -1, 0, 0, 0, 0, 3)
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯