I need to run multi-instances of my WinForms app. Any issues?

Posted on 2009-12-31
Last Modified: 2013-12-17
I need to run multi-instances of my WinForms C# application. What issues can I expect?

I'd like to use the same EXE. BUT, each instance will be associated with a unique copy of an Access database. Each is a different restaurant with a unique identifier.

1) How can the program know if a given restaurant is already running? I want it to load no more than one time per restaurant.
2) I use Microsoft MapPoint's ActiveX control. Will they automatically share it and will Windows handle the multi-user aspect of this use?
3) I intend the first instance to be the only instance which can dispose of the MapPoint ActiveX COM object. Refreshing this instance is an important thing to do to keep it working properly I am told by Microsoft, at least for the 2004 version.
4) How can I make different instances of the EXE communicate with one another?

What difficulties/challenges does this model present?

Question by:newbieweb
    1 Comment
    LVL 1

    Accepted Solution

    1) Create a mutex, using the name of a restaurant.  When a new instance of the application starts, retrieve the list of restaurant names from a shared database, and run through the list of restaurants attempting to obtain a mutex for each one until you get one you are able to obtain.  If you cannot obtain any of the mutexes based on the restaurant names, then every restaurant application is already running, so just shut down.

    see here:

    2) As for sharing the MapPoint activex control in more than one should be easy to figure out if you cannot find any documentation.  Create an application with the map point control, and run it twice...look in the task manager and see if the MapPoint process is created twice.

    3) When you close your application, go through the mutex process again, and if you are able to obtain every mutex, then your instance is the last instance dispose of the COM object.

    4) Use .net remoting to communicate between instances of your application.  Register the channels using the restaurant name, then you can communicate with every other restaurant application intance on the channel that matches the restaurant name.

    see here:

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    746 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