Pass paramters to an application while openning a file
-
Hi, everyone: I have a problem about how to open a document file with a specific application or pass some parameters into the application while opening the document file. For example: I need to open a .nrv file, a Nero file. But using ShellExecute() would always open Nero in traditional mode. I wanna open the .nrv file by Nero Express. I examine the shortcut of the Nero Express is like this: "C:\Program Files\Ahead\Nero\nero.exe" /w It looks like passing a parameter into the nero.exe, how can I do that through programming? Thanks!
-
Hi, everyone: I have a problem about how to open a document file with a specific application or pass some parameters into the application while opening the document file. For example: I need to open a .nrv file, a Nero file. But using ShellExecute() would always open Nero in traditional mode. I wanna open the .nrv file by Nero Express. I examine the shortcut of the Nero Express is like this: "C:\Program Files\Ahead\Nero\nero.exe" /w It looks like passing a parameter into the nero.exe, how can I do that through programming? Thanks!
In ShellExecute
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);pass
\W
inlpParameters
"I Think this Will Help" Alok Gupta
visit me at http://www.thisisalok.tk -
In ShellExecute
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);pass
\W
inlpParameters
"I Think this Will Help" Alok Gupta
visit me at http://www.thisisalok.tkBut that would only execute Nero Express but not open the .nrv file if
lpFile
is passed with the path of nero.exe andlpParameters
is passed with/w
. On the other hand, iflpFile
is passed with the path of the .nrv file, the parameter/w
is ignored since it views .nrv file as a document file, as MSDN said. Actually it didn't work...:sigh: But thanks for your reply anyway...:) My code is like this: // csFilePath is a CString object which is equal to the path of the nero.exe // or the path of the .nrv file.ShellExecute(GetSafeHwnd(), NULL, csFilePath, "/w", NULL, SW_SHOWNORMAL);
-
But that would only execute Nero Express but not open the .nrv file if
lpFile
is passed with the path of nero.exe andlpParameters
is passed with/w
. On the other hand, iflpFile
is passed with the path of the .nrv file, the parameter/w
is ignored since it views .nrv file as a document file, as MSDN said. Actually it didn't work...:sigh: But thanks for your reply anyway...:) My code is like this: // csFilePath is a CString object which is equal to the path of the nero.exe // or the path of the .nrv file.ShellExecute(GetSafeHwnd(), NULL, csFilePath, "/w", NULL, SW_SHOWNORMAL);
-
But that would only execute Nero Express but not open the .nrv file if
lpFile
is passed with the path of nero.exe andlpParameters
is passed with/w
. On the other hand, iflpFile
is passed with the path of the .nrv file, the parameter/w
is ignored since it views .nrv file as a document file, as MSDN said. Actually it didn't work...:sigh: But thanks for your reply anyway...:) My code is like this: // csFilePath is a CString object which is equal to the path of the nero.exe // or the path of the .nrv file.ShellExecute(GetSafeHwnd(), NULL, csFilePath, "/w", NULL, SW_SHOWNORMAL);
ytod wrote: ShellExecute(GetSafeHwnd(), NULL, csFilePath, "/w", NULL, SW_SHOWNORMAL); Use it this way
CString str;
str.Format("/w %s",lpFileNameToOpen
)then
ShellExecute(GetSafeHwnd(), NULL, csFilePath,
str
, NULL, SW_SHOWNORMAL);
"I Think this Will Help"
Alok Gupta
visit me at http://www.thisisalok.tk