|
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const GWL_STYLE As Long = (-16)
Private Const WS_CAPTION As Long = &HC00000
Dim hWnd, IStyle
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As LongPtr) As Long
Private Sub Label2_Click()
MsgBox "来了"
Unload Me
End Sub
Private Sub UserForm_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
hWnd = FindWindow(vbNullString, Me.Caption) '获取窗口句柄
IStyle = GetWindowLong(hWnd, GWL_STYLE)
IStyle = IStyle And Not WS_CAPTION
SetWindowLong hWnd, GWL_STYLE, IStyle
DrawMenuBar hWnd
End Sub
|
|