新建From1(窗体),新建Command1(按钮CommandButton),代码:
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_MAXIMIZE = 3
Const SW_SHOWNOACTIVATE = 4
Const SW_SHOW = 5
Const SW_MINIMIZE = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_RESTORE = 9
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Dim rval As Long
rval = ShowWindow(Form1.hwnd, SW_HIDE) 'Hide Window
Sleep 2000
rval = ShowWindow(Form1.hwnd, SW_SHOWMINIMIZED) 'Show Minimize
Sleep 2000
rval = ShowWindow(Form1.hwnd, SW_MAXIMIZE) 'Show Maximize
Sleep 2000
rval = ShowWindow(Form1.hwnd, SW_RESTORE) 'Restore Window
Sleep 2000
End Sub