1

I have it set so if you open a file, it launches my application and adds it to the start-up arguments. But how can I make it so if I double click on a file it loads it in the application that's already running? Rather than loading each file into it's own instance of the application.

2

3 Answers 3

2

Mutex is want you need to have a single instance of the application.

bool createdNew = true; using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew)) { if (createdNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } 

You can refer this LINK for detailed information.

Sign up to request clarification or add additional context in comments.

Comments

0

use mdiParent and child forms in C# I think it's great feature of vs C#


for more inforamtion: http://msdn.microsoft.com/en-us/library/d4dabts7%28v=vs.80%29.aspx

Comments

0

You need to make your application single-Instance, see this article:

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.