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
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Const SWP_FRAMECHANGED = &H20
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const HWND_TOP = 0
Private hasTitleBar As Boolean
Public Sub TitleBarChange()
Dim L As Long
L = GetWindowLong(Application.hwnd, GWL_STYLE)
If hasTitleBar Then
L = L Or WS_CAPTION
Else
L = L And Not (WS_CAPTION)
End If
L = SetWindowLong(Application.hwnd, GWL_STYLE, L)
hasTitleBar = Not hasTitleBar
SetWindowPos Application.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE