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

Posted on 2004-11-21
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, _
        End If
    End Sub
Question by:rkckjk
    LVL 6

    Expert Comment

    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?
    LVL 2

    Author Comment

    The exe sits on a network drive and is run on the client machines.
    LVL 6

    Accepted Solution

    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.
    LVL 18

    Expert Comment

    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

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now