Click to See Complete Forum and Search --> : IS IT POSSIBLE TO SEND PARAM????


August 5th, 1999, 06:02 PM
Hi,

Is it possible to pass parameters to mfc application (dialog based) when it is invoked??. ie I have vc++ application APP1, using CreateProcess(...) launches another vc++ app(dialog based) APP2, How to gather the parameters sent from the CreateProcess() in the APP2.

Thanx

PeterK
August 6th, 1999, 02:50 PM
You can do something like this in the program using createProcess:

char pathStr[MAXPATH] = "c:\myPath\myProgram.exe";
char commandLine[100] = "1 1 0";

CreateProcess(pathStr,
commandline,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&suInfo,
&procInfo);

In the program that is being executed do something like this...


LPTSTR pCommandLine;
pCommandLine = GetCommandLine();

if(pCommandLine == NULL)
{
// error
}

August 7th, 1999, 06:31 PM
Thanx a lot. I got it working.