7,763
社区成员
发帖
与我相关
我的任务
分享
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 GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Enum SetWindowPosConstants
SWP_ASYNCWINDOWPOS = &H4000
SWP_DEFERERASE = &H2000
SWP_FRAMECHANGED = &H20
SWP_HIDEWINDOW = &H80
SWP_NOACTIVATE = &H10
SWP_NOCOPYBITS = &H100
SWP_NOMOVE = &H2
SWP_NOOWNERZORDER = &H200
SWP_NOREDRAW = &H8
SWP_NOREPOSITION = SWP_NOOWNERZORDER
SWP_NOSENDCHANGING = &H400
SWP_NOSIZE = &H1
SWP_NOZORDER = &H4
SWP_SHOWWINDOW = &H40
End Enum
Private Const WS_SYSMENU = &H80000
Private Const WS_MINIMIZE = &H20000000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZE = &H1000000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
Private Const WS_BORDER = &H800000
Private Const WS_THICKFRAME = &H40000
Private Const GWL_STYLE = (-16)
Private Sub TitleBarVisible(hwnd As Long, Value As Boolean)
Dim Style As Long
Style = GetWindowLong(hwnd, GWL_STYLE)
If Value Then
Style = Style Or WS_SYSMENU
Style = Style Or WS_MAXIMIZEBOX
Style = Style Or WS_MINIMIZEBOX
Style = Style Or WS_CAPTION
Style = Style Or WS_THICKFRAME
Else
Style = Style And Not WS_MAXIMIZEBOX
Style = Style And Not WS_CAPTION
Style = Style And Not WS_THICKFRAME
End If
SetWindowLong hwnd, GWL_STYLE, Style
SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Sub
Private Sub Form_Load()
TitleBarVisible Me.hwnd, False
End Sub