vb窗口置顶函数

前端之家收集整理的这篇文章主要介绍了vb窗口置顶函数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

模块函数

Public Type POINT
X As Long
Y As Long
End Type


Public capture As Boolean
Public CursorPosition As POINT


Global Const WM_GETTEXT = &HD
Global Const WM_GETTEXTENGTH = &HE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Global Const SWP_NOACTIVATE = &H10
Global Const SWP_SHOWWINDOW = &H40
Public Declare Function GetCursorpos Lib "user32" (ByRef lpPoint As POINT) As Long
Public Declare Function WindowFromPoint Lib "user32" (ByVal X As Long,ByVal Y As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,ByVal wMsg As Long,ByVal wParam As Long,lParam As Any) As Long
Public Declare Function SendMessagebystring Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long,lParam As String) As Long
Public Declare Sub 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)
窗体函数(option)

Private Sub Check1_click()If Check1.Value = 1 Then SetWindowPos Form1.hwnd,HWND_TOPMOST,Form1.Left / 15,Form1.Top / 15,Form1.Width / 15,Form1.Height / 15,SWP_NOACTIVATE Or SWP_SHOWWINDOWElse SetWindowPos Form1.hwnd,HWND_NOTOPMOST,SWP_NOACTIVATE Or SWP_SHOWWINDOWEnd IfEnd Sub

猜你在找的VB相关文章