|
-
Aug 20th, 2002, 07:44 PM
#1
Thread Starter
Member
Check for Running Instance of an application
Hi,
I'm trying to keep from running multiple instances of the rundll32.exe (open with dialog.). I've read alot of topics on the forum and they all seem to be about app.prevInstance, but can't find one dealing with outside applications. Can anybody point me in the right direction? Thanks alot, Rick
Shell ("rundll32.exe shell32.dll,OpenAs_RunDLL " & strFullName)
-
Aug 21st, 2002, 07:08 AM
#2
Try this...
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim WinWnd As Long
WinWnd = FindWindow(vbNullString, strFullName)
If WinWnd = 0 Then
MsgBox "Application Not Running"
Else
MsgBox "Application Already Running"
End If
End Sub
-
Aug 21st, 2002, 07:11 AM
#3
Retired VBF Adm1nistrator
Regarding App.PrevInstance
That is only for your own current application.
So in your Main() or Form_Load() Sub you would check for App.PrevInstance, and that would tell you if this app is already running or not.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 21st, 2002, 11:14 AM
#4
Thread Starter
Member
Thanks for the replies. Thanks Hack, that is perfect!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|