你在问题中没有说明白,也难怪楼上的的
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SW_HIDE = 0
Private Sub Command1_Click()
Dim WinWnd As Long
WinWnd = FindWindow(vbNullString, "计算器")
If WinWnd <> 0 Then
ShowWindow WinWnd, SW_HIDE
End If
End Sub
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'显示Form2
Private Sub Command1_Click()
ShowWindow Form2.hwnd, SW_SHOW
End Sub
'隐藏Form2
Private Sub Command2_Click()
ShowWindow Form2.hwnd, SW_HIDE
End Sub
那只要获取窗口句柄就可以了