0

I am writing an application that includes processing of files of a custom file format but would like to associate with my application such that when a supported file is double clicked on in Windows Explorer it can automatically calls my application's open event.

Please note the application is a .NET application. If you could point me to a reference I need to add or a class I have missed please let me know.

RonaldMunodawafa
  • 223
  • 3
  • 11

2 Answers2

1

You probably know, that associating a double click with LAUNCHING an application is relatively easy. If not, here is a good SO answer.

The problem is, you don't want to LAUNCH a new application, rather raise an event in an existing one. Well, I don't know if there is a direct way for that, but you could write a small console executable, associate THAT with the file type, and in that application fire off a call to your main one (I'm thinking WCF Named Pipes would be the easiest to use), and at startup of your main application start listening to the pipe. If a message comes in (containing the path of the file, most likely), raise the internal Open event of your application, with whatever information passed as parameter.

Hope this helps.

Community
  • 1
  • 1
TDaver
  • 7,164
  • 5
  • 47
  • 94
0

You might want to look here for how to handle single instance:

https://codereview.stackexchange.com/a/25667

Associating filetype with application is pretty easy as well, and you can even have your application do the association on first run.

Associate File Extension with Application

Community
  • 1
  • 1
John
  • 6,503
  • 3
  • 37
  • 58