Launch App With File

RobEmDee

Centurion
Joined
Mar 25, 2003
Messages
130
Location
Richmond, VA
I have a Windows Forms application for which I have created a custom file type that the application works with. Once my custom file extension is associated with my application on the user's machine, I'd like for the user to be able to lauch the application and load a specific file by double-clicking on the file in Windows Explorer. Does anyone have an example for accomplishing this? Thanks!
 
RobEmDee said:
I have a Windows Forms application for which I have created a custom file type that the application works with. Once my custom file extension is associated with my application on the user's machine, I'd like for the user to be able to lauch the application and load a specific file by double-clicking on the file in Windows Explorer. Does anyone have an example for accomplishing this? Thanks!

You have to associate it in the registry and set your program up to handle the load arguments...You can parse the command line using Environment.GetCommandLineArgs.

As for the association part, i'd have the installer do it, but if you wanted to do it programatically...File Association Module Not sure if it works with .NET, you'll have to use System.Runtime.Interop and change the API commands... but if not, it should give you an idea of the registry keys that you'll have to check for/create.

-Sean
 
Back
Top