EMPHelpdesk
asked on
How do I open any file in C or C++` in its native application?
I want the user to type in the path of the file they want to open and have it run as if you double clicked it. This is in windowsXP.
I know how to prompt the user and get the string they enter, but am having trouble with the opening part. I have tried WinExec and CreateProcess which seems to work for opening a specific application but not for taking a variable to point to a specific file.
I would prefer the answer in C if it is possible. C++ if not.
Thank you
I know how to prompt the user and get the string they enter, but am having trouble with the opening part. I have tried WinExec and CreateProcess which seems to work for opening a specific application but not for taking a variable to point to a specific file.
I would prefer the answer in C if it is possible. C++ if not.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The easiest way I've found is to use ShellExecute: http://msdn2.microsoft.com/en-us/library/bb762153.aspx