[C++]CreateProcess()

01/16/2012 12:26 -impulse-#16
Quote:
Originally Posted by Korvacs View Post
Yes you need a space, but that's not in order to put the argument at the second position, that's just to separate the Arguments from the executable path. All applications require this.
In other words, what I want to say is:
Code:
void main(){
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    memset(&si, 0, sizeof(si));
    memset(&pi, 0, sizeof(pi));
    si.cb = sizeof(si);
    char * procName = "D:\\Conquer Online 2.0\\Conquer.exe";
    [SIZE="4"][B]char * procArg  = " blacknull";[/B][/SIZE]
    if(CreateProcess(procName,procArg,0,0,0,CREATE_DEFAULT_ERROR_MODE,0,"D:\\Conquer Online 2.0",&si,&pi))
         return 0;
    printf("CreateProcess failed (%d).\n", GetLastError() );
    system("Pause");
}
should work.
01/16/2012 13:30 Mr_PoP#17
Quote:
Originally Posted by -impulse- View Post
In other words, what I want to say is:
Code:
void main(){
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    memset(&si, 0, sizeof(si));
    memset(&pi, 0, sizeof(pi));
    si.cb = sizeof(si);
    char * procName = "D:\\Conquer Online 2.0\\Conquer.exe";
    [SIZE="4"][B]char * procArg  = " blacknull";[/B][/SIZE]
    if(CreateProcess(procName,procArg,0,0,0,CREATE_DEFAULT_ERROR_MODE,0,"D:\\Conquer Online 2.0",&si,&pi))
         return 0;
    printf("CreateProcess failed (%d).\n", GetLastError() );
    system("Pause");
}
should work.
yeah you are right the space working thanks ;)