ついでなので全部答えます。(^^;
'以下 Option Explicit
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long 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 = 9
Private Const APP_CAPTION = "UzApplication"
Private Sub Form_Load() Dim nRet As Long Me.Caption = "DUMMY_CAPTION" If App.PrevInstance = -1 Then 'Call MsgBox("このアプリケーションは既に起動されています。", vbInformation, "二重起動防止 サンプルプログラム") nRet = FindWindow(vbNullString, APP_CAPTION) Call SetForegroundWindow(nRet) Call ShowWindow(nRet, SW_RESTORE) End End If Me.Caption = APP_CAPTION End Sub '以上
|