如何让一个窗口总是处于各窗口的最上层?

来源:百度知道 编辑:UC知道 时间:2024/05/10 06:45:47

代码如下:
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
Const HWND_TOPMOST = -1
Private Sub Form_Load()
SetWindowPos Me.hwnd,HWND_TOPMOST,Me.Left/Screen.TwipsPerPixelX, _
Me.Top\Screen.TwipsPerPixelY,Me.Width\Screen.TwipsPerPixelX, _
Form1.Height \ Screen.TwipsPerPixelY, 0
End Sub