Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetForegroundWindow& Lib "user32" (ByVal hwnd&)
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As LongPrivate Const WA_ACTIVE = 1
Private Const WA_CLICKACTIVE = 2
Private Const WA_INACTIVE = 0
Private Const WM_ACTIVATE = &H6
Private Const WM_ACTIVATEAPP = &H1CPrivate Const WM_SHOWWINDOW = &H18Private Const SW_SHOW = 5
Private Const SW_SHOWNORMAL = 1
Private Const SW_RESTORE = 9
Private Sub Form_Load()
    Dim lIns As Long
    Dim lWnd As Long
    Dim lRet As Long
    
    Me.Caption = ""
    If App.PrevInstance = True Then
        Debug.Print App.hInstance
        lIns = App.hInstance
        lWnd = FindWindow(vbNullString, "Alive")
        lRet = SetWindowText(lWnd, "Alive")
        lRet = ShowWindow(lWnd, SW_SHOWNORMAL)
        lRet = SetForegroundWindow(lWnd)
        Unload Me
        Exit Sub
    End If
    Me.Caption = "Alive"
    
End Sub