引用: 以下是引用南山下在2003-8-29 16:11:00的發(fā)言:
請教:
如何隱藏EXCEL和USERFORM的標題欄?
這個問題在論壇中有例子,但不知如何使用。
請高手詳細解惑?
您好:
請參考附件
Private Declare Function GetWindowLong Lib 'user32' Alias 'GetWindowLongA' (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function FindWindow Lib 'user32' Alias 'FindWindowA' (ByVal lpClassName As String, ByVal lpWindowName As String) 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 ShowWindow Lib 'user32' (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function DrawMenuBar Lib 'user32' (ByVal hwnd As Long) As Long
Private Declare Function SetFocus Lib 'user32' (ByVal hwnd As Long) As Long
Private Const WS_CAPTION As Long = &HC00000
Private Const GWL_STYLE = (-16)
Private Const SW_SHOW As Long = 5
Sub SetFormStyle(hwnd As Double)
Dim IStyle As Long
IStyle = GetWindowLong(hwnd, GWL_STYLE)
IStyle = IStyle And Not WS_CAPTION
SetWindowLong hwnd, GWL_STYLE, IStyle
ShowWindow hwnd, SW_SHOW
DrawMenuBar hwnd
SetFocus hwnd
End Sub
Sub UndoSetFormStyle(hwnd As Double)
Dim IStyle As Long
IStyle = GetWindowLong(hwnd, GWL_STYLE)
IStyle = IStyle Or WS_CAPTION
SetWindowLong hwnd, GWL_STYLE, IStyle
ShowWindow hwnd, SW_SHOW
DrawMenuBar hwnd
SetFocus hwnd
End Sub
Function hWndForm() As Long
hWndForm = FindWindow('ThunderDFrame', UserForm1.Caption)
End Function
Function hWndExcel() As Long
hWndExcel = FindWindow(vbNullString, Application.Caption) 'Excel
End Function
|