Hi,
I used CreateProcess in order to run an *.exe file .This execute need an input
file in order to run ,the input file is not need to be writen in the command line
in order to run the execute file.So I used CreateFile before the CreateProcess
But still I have an error:Can not find the input file!!!!.
What's wrong????
The code is:
hReadFile=CreateFile("d:\\text.txt", GENERIC_READ, FILE_SHARE_READ,
NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
// Execute the command with a call to the CreateProcess API call.
memset(&si,0,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.wShowWindow = SW_SHOW;
si.hStdInput=hReadFile;
CreateProcess(NULL,"d:\\presyn.exe",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
//remember to close owned handles
CloseHandle(pi.hThread);
//Remember to close the handle of the file
CloseHandle(hReadFile);
I used CreateProcess in order to run an *.exe file .This execute need an input
file in order to run ,the input file is not need to be writen in the command line
in order to run the execute file.So I used CreateFile before the CreateProcess
But still I have an error:Can not find the input file!!!!.
What's wrong????
The code is:
hReadFile=CreateFile("d:\\text.txt", GENERIC_READ, FILE_SHARE_READ,
NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
// Execute the command with a call to the CreateProcess API call.
memset(&si,0,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.wShowWindow = SW_SHOW;
si.hStdInput=hReadFile;
CreateProcess(NULL,"d:\\presyn.exe",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
//remember to close owned handles
CloseHandle(pi.hThread);
//Remember to close the handle of the file
CloseHandle(hReadFile);