VB中怎样让窗口总在最上层,并且在任务管理器的上层
不要复制过来的,简单点,就是PrivateSubForm_Load()和EndSub之间的一段代码怎么写?还请高手帮忙!这道题我提问了两次,谁会做,两个50分都给他.我试...
不要复制过来的,简单点,就是Private Sub Form_Load()和End Sub之间的一段代码怎么写?还请高手帮忙!
这道题我提问了两次,谁会做,两个50分都给他.
我试过了,还是不行啊,我是个菜鸟,能不能帮我看看
QQ464317696 展开
这道题我提问了两次,谁会做,两个50分都给他.
我试过了,还是不行啊,我是个菜鸟,能不能帮我看看
QQ464317696 展开
4个回答
展开全部
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控件去设置呢?
展开全部
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
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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我有一个不能再任务管理器的上层,但是可以再其他的程序的上层,不知道可以不可以!
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
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
厉害!这也行!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询