SKY外语计算机学习
标题:
让窗体始终保持最前
[打印本页]
作者:
SKY定格
时间:
2012-5-14 20:07
标题:
让窗体始终保持最前
本帖最后由 sky_yx 于 2015-12-30 14:22 编辑
'把以下代码加入模块中
Private Const HWND_TOPMOST = -1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOREPOSITION = &H200
Private Const SWP_NOSIZE = &H1
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
'TopMostForm
'若Top=true,使窗口始终位于屏幕最上层
'当Top=false时,取消这一属性
Public Sub TopMostForm(f As Form, Top As Boolean)
If Top Then
SetWindowPos f.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
Else
SetWindowPos f.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End If
End Sub
复制代码
欢迎光临 SKY外语计算机学习 (http://skywj.com/)
Powered by Discuz! X2.5