Prevent multiple instances of a single application from running

One of our users keeps opening the same application numerous times which causes him problems.  What I need is a way (program, application etc.) that will stop more than one instance of a particular, definable .exe from running and a method to prevent WIndows XP from hiding the application in the system tray.  If I can either diable the system tray auto hide feature or prevent a particular application from hiding and prevent more than one particular .exe from runningat a time, I'm in business!
Who is Participating?
icuadminAuthor Commented:
I found this handy bit of VB that does the trick:

On Error Resume Next
strComputer = "."
strProgramName = "notepad.exe"
strProgramPath = "c:\windows\system32\notepad.exe"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objShell = CreateObject("WScript.Shell")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = '" & strProgramName & "'")
If colProcessList.Count > 0 Then
    strMessage = "Program is Already Running!"
MsgBox strMessage
    objShell.Run strProgramPath
End If

And changed the icon I am interested in to never hide, job done!  Thanks for the suggestion though CPG.
Change the users shortcut for running the application so it points to a batch file.  In the batch file include a kill command, probably a wait command to last for 5 seconds, then a command to launch the application.  

Then if he tries to open the application and it is already open the kill command will close it and launch a fresh instance of the application that he can see.
So do I get any points for recommending use of a script?  That's what you've done.
icuadminAuthor Commented:
Fixed myself.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.