Opening file in associated application

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Hello
I would like to know how I could open my associated application and
the file within the application when the user double clicks the file.
Say for example, I have an application MyApplication and I have a file
test.myp in my computer. When I double click test.myp, I would like to
open MyApplication and test.myp within it. I have created my
application using C++.NET

Thanks
 
Hi Nathan,

Take a look at the 'ShellExecute' Win32 API. You can p/invoke this API
passing it your file name and the "open" command which will cause the file
to be opened using the default associated program.

HTH,
Gary
 
Alternatively, for a managed code solution use the Process class and look at
the ShellExecute property of the ProcessStartInfo class.

Gary
 
Back
Top