如何让窗体一直保持在最前端

来源:百度知道 编辑:UC知道 时间:2024/06/05 21:56:17
没有 formstyle这个属性

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, Me.Height \ Screen.TwipsPerPixelY, 0
End Sub

绝对好用,注意在VB6环境下测试好像不行,你生成EXE文件测试肯定行,我发之前还试过

formstyle属性改一下就行了