如何用VB做一个,在所有窗体前面的窗口

来源:百度知道 编辑:UC知道 时间:2024/05/13 00:44:41
请问各位大侠,在VB里面做一个位于所有窗体之前的窗口啊

这个要用到API
得到窗体的句柄Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
如果是自己的的就直接用me.hwnd好像就是你那个窗体的句柄
再根据其句柄改变窗休的显示.可以设其在最前要代码加我QQ

Public 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
如果是你自己的窗体的话
dim b as long
b= SetWindowPos(me.hwnd, -1, 0, 0, 0, 0, 3)
me.hwnd可以换成其他程序的窗体.你就用findwindow()找也可以枚举.

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

setwindowpos 0,0,0