- 积分
- 8584
- 明经币
- 个
- 注册时间
- 2004-6-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2011-7-3 10:13:03
|
显示全部楼层
'Module1
Option Explicit
'===============窗口置顶=====================================
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
Public Const HWND_TOPMOST = -1
Public Const HWND_BOTTOM = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H8
Const WM_KEYDOWN = &H100
Public Sub SetFormTopmost(TheForm As Form) '窗口置顶
SetWindowPos TheForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOZORDER + SWP_NOMOVE + SWP_NOSIZE
End Sub
Public Sub SetFormNoTopMost(TheForm As Form) '解除置顶
SetWindowPos TheForm.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOZORDER + SWP_NOMOVE + SWP_NOSIZE
End Sub
'--------------------------------------------------
'Form
Private Sub Form_Load()
SetFormTopmost Form1
End Sub
这是窗口置顶,但不知相对置顶怎么弄,就象记事本与查找对话框那样。 |
|