|
这是yuanzhuping网友在http://club.excelhome.net/viewth ... p;extra=&page=1
的一段程序
Option Explicit
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 GWL_EXSTYLE = (-20)
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_EX_DLGMODALFRAME = &H1&
Private Sub UserForm_Initialize()
Dim IStyle As Long
Dim Hwnd As Long
If Val(Application.Version) < 9 Then
Hwnd = FindWindow("ThunderXFrame", Me.Caption)
Else
Hwnd = FindWindow("ThunderDFrame", Me.Caption)
End If
IStyle = GetWindowLong(Hwnd, GWL_STYLE)
IStyle = IStyle And Not WS_CAPTION
SetWindowLong Hwnd, GWL_STYLE, IStyle
DrawMenuBar Hwnd
IStyle = GetWindowLong(Hwnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME
SetWindowLong Hwnd, GWL_EXSTYLE, IStyle
End Sub
Private Sub UserForm_Click()
Unload Me
End Sub
问:无标题栏和边框的窗体只能用API方法吗? |
|