After playing around with a new Windows Form project, I discovered that when you associate a file type with an executable in Windows, you can find the file path of the file that launched the application using args[0]
from static void Main(string[] args)
Is it possible to launch an event on your application when you double click a file if your application is already open? (As obviously Main(string[] args)
won't be triggered).
Example of an application with behavior I am attempting to replicate:
- User Opens GIMP(in Windows)
- User opens explorer and right clicks a .png file
- User selects open with GIMP
- Instead of creating a new application instance of GIMP, GIMP opens the picture in a new window within the instance of GIMP that was already opened.
In this case is GIMP employing multiple applications to accept files "opened" with file association? Or is it possible to do it with a single application "instance".
I'm having trouble with this as most of my searches tend to lead me towards file association as a Windows user (i.e. "How to associate .xls files with excel" articles).