语法求助: IStyle = IStyle And Not WS_CAPTION
本帖最后由 liuzpzp007 于 2012-12-15 14:14:50 编辑
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
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
Private Sub UserForm_Initialize()
Dim AppV!, hwnd&, IStyle&
AppV = Application.Version '判断Excel版本
If Val(AppV) < 9 Then
hwnd = FindWindow("ThunderXFrame", Me.Caption) '获得ThunderRTMain类的隐藏窗口的句柄
Else
hwnd = FindWindow("ThunderDFrame", Me.Caption)
End If
IStyle = GetWindowLong(hwnd, GWL_STYLE) '从指定窗口的结构中取得信息, GWL_STYLE:窗口样式,即取得窗口样式信息
IStyle = IStyle And Not WS_CAPTION
SetWindowLong hwnd, GWL_STYLE, IStyle
DrawMenuBar hwnd
End Sub