Opening file in associated application

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
 
G

Gary Milton

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
 
G

Gary Milton

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

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top