How can I check for my running program instance? Lets say I am running program prog1.exe, If I run it again, I want to have a messaga saying that the program is already running, How can Chech for this. Any hint is appretiated. Thanks.
Printable View
How can I check for my running program instance? Lets say I am running program prog1.exe, If I run it again, I want to have a messaga saying that the program is already running, How can Chech for this. Any hint is appretiated. Thanks.
if app.previnstance then
msgbox "Already running!"
end
end if
There might be occasions when you do want to allow multiple instances of your program, but would like to keep track of how many are running at once. If so, you can use this:VB Code:
Dim Response As Variant If App.PrevInstance = True Then Response = MsgBox("Your program is already running. Do you wish to open a second instance?", vbYesNo + vbQuestion, "Already Running") If Response = vbNo Then End End If End If 'insert code to log a new instance and let the program continue