Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Const SW_RESTORE = 9Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long Private Sub Form_Load() Dim tmp As String Dim h As Long If App.PrevInstance Then tmp = Me.Caption Me.Caption = "" h = FindWindow(vbNullString, "你的窗口的标题栏文字") If h Then ShowWindow h, SW_RESTORE SetForegroundWindow h End End If End If End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_RESTORE = 9Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Load()
Dim tmp As String
Dim h As Long
If App.PrevInstance Then
tmp = Me.Caption
Me.Caption = ""
h = FindWindow(vbNullString, "你的窗口的标题栏文字")
If h Then
ShowWindow h, SW_RESTORE
SetForegroundWindow h
End
End If
End If
End Sub