3个回答
展开全部
引用API函数SetWindowPos就可以解决。下面看看代码:岁昌
Private Declare Function SetWindowPos Lib "user32.dll" (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
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const FLAG = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const HWND_TOP = 0
Const HWND_BOTTOM = 1
将窗口设置最前:Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAG)
取脊铅消窗口的最前:Call SetWindowPos(Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAG)
函乎野扒数的第一个参数是根据实际情况改变的,它要求给它传送一个窗口的句柄,这里的 Me.hwnd 就给函数传送了当前窗口的句柄,也就是将当前窗口前置或取消前置。如果要前置其他窗口,那么请向函数传送其他窗口的句柄,这个可以根据:FindWindow API函数获取。
展开全部
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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 Sub Form_Load()
SetWindowPos Me.hwnd,-1,0,0,0,0,3
End Sub
Private Sub Form_Load()
SetWindowPos Me.hwnd,-1,0,0,0,0,3
End Sub
参考资料: VB探讨超级群 48029944
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询