Passing parameter through ShellExecute
-
Hi all, I want to pass a CString parameter through ShellExecute() api to my exe.. I am doing this using this code:-
CString CurrentPath = _T("C:\\test\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,NULL,NULL,SW_SHOW);My problem is i don't know how to access this parameter in my exe. Can anybody tell me how to do so?? Thanks in advance
-
Hi all, I want to pass a CString parameter through ShellExecute() api to my exe.. I am doing this using this code:-
CString CurrentPath = _T("C:\\test\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,NULL,NULL,SW_SHOW);My problem is i don't know how to access this parameter in my exe. Can anybody tell me how to do so?? Thanks in advance
I see no exe in the above code. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
I see no exe in the above code. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkesorry i posted wrong code
CString CurrentPath = _T("C:\\test.exe");
CString para = _T("c:\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,para ,NULL,SW_SHOW);what i want is i want to access para value in my test.exe code
-
sorry i posted wrong code
CString CurrentPath = _T("C:\\test.exe");
CString para = _T("c:\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,para ,NULL,SW_SHOW);what i want is i want to access para value in my test.exe code
Hi, it depends on language and compiler. Most often you can get the command line as a string and/or the command line parts as a string array; look for: - the (optional) arguments of your main or WinMain function; - a library function such as GetCommandLine. BTW: When an array is returned, most likely the first element is the path of the EXE itself. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.