Link to home
Start Free TrialLog in
Avatar of Richard Kreidl
Richard KreidlFlag for United States of America

asked on

Check for a previous instance of an app on a network?

I found the code below on how to check for a previous instance of an app, but I don't think this will work for a network executeable. So, how do you check to see if there is multiple instances of an executeable running on a network?

Public Sub CheckForExistingInstance()
        'Get number of processes of you program
        If Process.GetProcessesByName _
          (Process.GetCurrentProcess.ProcessName).Length > 1 Then

       MessageBox.Show _
        ("Another Instance of this process is already running", _
            "Multiple Instances Forbidden", _
             MessageBoxButtons.OK, _
            MessageBoxIcon.Exclamation)
           Application.Exit()
        End If
    End Sub
Avatar of platinumbay
platinumbay

By network executable, are you referring to an exe that sits on a network drive, and is run on the client machines, or do all instances run on the network server?
Avatar of Richard Kreidl

ASKER

The exe sits on a network drive and is run on the client machines.
ASKER CERTIFIED SOLUTION
Avatar of platinumbay
platinumbay

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you want to check if the same application should not run on the client machine again. But may run on any other network computer Then the above mentioned code will run..
Otherwise the only solution is what is suggested by platinumbay