Option Explicit
Public Const WM_SYSCOMMAND = &H112
Public Const SC_CLOSE = &HF060&
Public Const SC_MINIMIZE = &HF020&
Public Const SC_MAXIMIZE = &HF030&
Public Const SC_RESTORE = &HF120&
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Option Explicit
Private Sub Command1_Click()
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, ByVal 0&
End Sub
Private Sub Command2_Click()
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MINIMIZE, ByVal 0&
End Sub
Private Sub Command3_Click()
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_RESTORE, ByVal 0&
End Sub
Private Sub Command4_Click()
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_CLOSE, ByVal 0&
End Sub