#If VBA7 Then
#If Win64 Then
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
#End If
Private Const WS_DLGFRAME = &H400000
Private Const WS_BORDER = &H800000
Private Const WS_CAPTION = WS_BORDER Or WS_DLGFRAME
Private Const WS_SYSMENU = &H80000
Private Const WS_SIZEBOX = &H40000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_THICKFRAME = &H40000
Private Const WS_FULLSYSTEM = &H94CF0080
Private Const WS_SYSTEMO = &H94C80080
Private Const GWL_STYLE = -16
Private Sub CommandButton1_Click()
applique True, True, False, True
End Sub
Private Sub CommandButton2_Click()
applique True, False, True, False
End Sub
Private Sub CommandButton3_Click()
applique
End Sub
Private Sub CommandButton5_Click()
applique False
End Sub
Sub applique(Optional caption As Boolean = True, _
Optional reduire As Boolean = True, _
Optional agrandir As Boolean = True, _
Optional resizeb As Boolean = True)
Dim H As LongPtr
H = FindWindow(vbNullString, Me.caption)
If Not caption Then
SetWindowLongPtr H, GWL_STYLE, WS_SYSTEMO And Not WS_CAPTION
Me.Width = Me.Width + 1
Me.Width = Me.Width - 1
Else
SetWindowLongPtr H, GWL_STYLE, WS_FULLSYSTEM _
And Not (WS_MINIMIZEBOX And Not reduire) _
And Not (WS_MAXIMIZEBOX And Not agrandir) _
And Not (WS_SIZEBOX And Not resizeb)
End If
End Sub
Private Sub CommandButton4_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub