0

I have create a C# application using Visual Studio 2010 and Installshield. I have included a file association to open the application by double-clicking on any filename with the specific extension. However, this open a new instance of the aplication. If the application is already running I want to open the document as a new window in it. How do I do this?

  • Just for clarification: Whether you get a single instance of your application or not is not something that depends on the install process or the registration of your file association. It is something that your application needs to handle explicitly, i.e. whenever you start an instance you need to check for already running instances and possibly pass any command line arguments to the already running instance. The already running instance then needs to be able to handle the passed arguments. – Dirk Vollmar Dec 07 '15 at 09:34
  • I know that is what I need to do, but how do I do it? – user1358841 Dec 07 '15 at 12:32
  • The article "What is the correct way to create a single instance application" describes a way of configuring the application so that if the user tries opening another instance a message would be displayed saying "only one instance at a time". That isn't what I want – user1358841 Dec 07 '15 at 12:35
  • "That isn't what I want" - So can you describe what it is that you want? If it is passing the command line arguments you should have a look at Dale's answer. – Dirk Vollmar Dec 07 '15 at 12:48
  • This is how I want it to work: – user1358841 Dec 07 '15 at 15:55
  • This is how I want it to work: (1) If I double-click on a filename and the application isn't already running I want to open the application with the file loaded (I actually found a clear explanation of how to do this at http://www.codeproject.com/Articles/4430/Single-Instance-Application-in-C). (2) If I double-click on a filename when the application is already running with a file loaded, the new file will be opened in a new child window (this is how, for example, Microsoft Excel works) – user1358841 Dec 07 '15 at 16:08
  • All of this is described in the linked question. I doubt you will get any more help in this question (as it is already closed), so if you have a particular problem with the implementation you'd better post a new question with that particular problem and a reduced code sample of the code that you already have. – Dirk Vollmar Dec 07 '15 at 16:17

0 Answers0