Prevent two instances of same program

August 31, 2012 at 08:32:03
Specs: Windows XP
Hi, I have an issue with a closed source program designed back in the day with limited updates. There is an 'add-on' or sorts to the main program which loads up on certain commands. This 'add-on' then communicates through a variety of ways to external devices (56k, LAN, WAN etc), however if you have more than one instance open then there are conflicts and cause the connection to fail. No matter how much training is given to people they never seem to check if it is already running. I know that a mutex should be written in the program, but that is never going to happen, is there any software or a vbscript that could be run to prevent this? It is primarily used in Windows XP

See More: Prevent two instances of same program

Report •


#1
August 31, 2012 at 08:52:06
Might construct a scheme that secondary loads this app.
Even a thing such as a batch file that does a check then runs the app. Remove simple access to direct running. Get more complex and disallow by permission if it has registry to use runas.


Report •

#2
August 31, 2012 at 09:03:49
Something like this?
If GetObject("winmgmts:").ExecQuery( _
    "SELECT * FROM Win32_Process WHERE Name='notepad.exe'").Count = 0 Then _
  CreateObject("WScript.Shell").Run "%windir%\notepad.exe"

How To Ask Questions The Smart Way


Report •

#3
September 3, 2012 at 02:02:56
Would this then be set to run as a service, constantly checking if there is already an instance running? if so how would I go about writing that in? thank you!

Report •

Related Solutions

#4
September 3, 2012 at 05:39:08
It checks to see if, in this instance, notepad is running. If it's not, it runs a copy of notepad. Suggested usage is to modify the program's shortcut to call this script, and have this script call the program in question.

How To Ask Questions The Smart Way


Report •

Ask Question