How do programs handle the "open with ..." file?
I am wondering if anyone can point me in the right direction. Do you know how, for example, in most IDEs, if you open a source file with "open with", it runs the program and opens it? and then if you open another one will it open it in a new tab in the same process?
My question is NOT how to add a program to shell commands, but rather:
-
How does a C # application "get" a PDF file, for example?
-
How will an application open a file in the same process when another file is launched with it (without having instances of the program)?
a source to share
When the second instance of the program starts, it checks to see if another instance of the program is running before loading any interface components . If so, it communicates with it in some way (program specific: it could be sockets, inter process interrupts, shared memory, etc.) so that it opens this new file.
After passing this message to the first instance, the second instance of the program will terminate because it is no longer needed.
a source to share
Here is a detailed post that explains the correct implementation:
http://www.iridescence.no/post/CreatingaSingleInstanceApplicationinC.aspx
This thread has a discussion and sample for handling command line arguments (this is how files are passed to your application): http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic62109.aspx
a source to share