大家都知道AppActivate 函数可以激活窗口,但是我想知道把一个窗口放在底层是那个函数?多谢指教!
[此贴子已经被作者于2006-11-7 11:30:01编辑过]
利用API函数实现窗口的置顶
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
Public Const HWND_TOPMOST = -1 '置顶
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const HWND_NOTOPMOST = -2 '不置顶
然后在事件里面添加代码:
'窗口在顶层
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
'取消窗口在顶层
'Call SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)
或者是下面那样也可以:
置顶:
Call SetWindowPos(handle,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE or swp_nosize or swp_nomove);
取消置顶:
Call SetWindowPos(handle,HWND_NOTOPMOST,0,0,0,0,SWP_NOACTIVATE or swp_nosize or swp_nomove);