'以隐藏计算器为例
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE As Long = 0
Private Sub Command1_Click()
'启动计算器
Shell "C:/WINDOWS/system32/calc.exe", 1
End Sub
Private Sub Command2_Click()
Dim hwnd As Long
hwnd = FindWindow("SciCalc", "计算器")
If hwnd <> 0 Then
ShowWindow hwnd, SW_HIDE
MsgBox "计算器隐藏成功"
End If
End Sub
'ShowWindow hWnd, 0 '隐藏
'ShowWindow hWnd, 5 '显示