?
Solved

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

Posted on 2004-11-21
4
Medium Priority
?
165 Views
Last Modified: 2011-10-03
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
0
Comment
Question by:Richard Kreidl
  • 2
4 Comments
 
LVL 6

Expert Comment

by:platinumbay
ID: 12640907
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?
0
 
LVL 2

Author Comment

by:Richard Kreidl
ID: 12641184
The exe sits on a network drive and is run on the client machines.
0
 
LVL 6

Accepted Solution

by:
platinumbay earned 1000 total points
ID: 12641220
You could have the Exe check a value in a network db or file, if the value is 1, then kill itself, if not, then make the value 1 and run.  You should probably look at using a transactional class and database so two users don't write 1 at the same time.
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12641472
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
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question