You can start an application by the name of its *.EXE file using the function
CreateProcess
,
ShellExecute
or
ShellExecuteEx
:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762154%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx[
^].
You can pass anything to the process you are starting only if the application is designed to accept this data: file name or anything at all. Usually, good application can accept and handle
command line parameters. When you start an application, you can always specify some command line parameters, which is documented in the MSDN help articles referenced above.
If you need to pass some file name to be requested from the user; and it is not done in the application your are starting, you should request the file in your UI using the standard MFC file dialog and then pass it to the application (if it is designed to accept it, of course). Please see:
http://msdn.microsoft.com/en-us/library/dk77e5e7%28v=vs.71%29.aspx[
^].
You application should be responsible for preparation of the file, file conversion, proper file type and everything like that. The accepting and processing of the file depends on how the application you start works.
That said, it's always bad to rely on some application which is not a part of your solution. You always have very limited control over such application. If you have the source code of this application which you can support, it's much advised to convert it to a DLL for in-proc use; this way you would gain a full control.
—SA