投稿日 | : 2004/07/22(Thu) 17:33 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re^5: アプリの複数起動を禁止したい |
そうそうすべてどんぴしゃのサンプルは転がっていませんよ。
名前が同じで区別できなければ変更すればいいだけの事です。
Private Sub Form_Load()
Dim strCaptionName As String
Dim retValue As Long
Dim lnghwnd As Long
If App.PrevInstance = True Then
Me.Caption = "2重起動"
strCaptionName = "検索画面"
lnghwnd = FindWindow(vbNullString, strCaptionName)
retValue = IsIconic(lnghwnd)
If retValue Then
retValue = OpenIcon(lnghwnd)
End If
retValue = SetForegroundWindow(lnghwnd)
Unload Me
End If
End Sub
最小化されている場合の処理が抜けていましたので追加
又、End ステートメント は使用しない方がいいかと。