读书人

语法 IStyle = IStyle And Not WS_CAP

发布时间: 2013-01-02 13:08:44 作者: rapoo

语法求助: 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


其中的 IStyle = IStyle And Not WS_CAPTION是什么意思,谢谢大家!




[解决办法]
将 IStyle 和 &HC00000 的按位非值进行按位与.
[解决办法]
简单的讲就是把Window Style里面的WS_CAPTION拿掉。

读书人网 >VB

热点推荐