Problem in invoking CreateProcess API
The sample code from MSDN illustrating CreateProcess is not working for me in VC++ 8. TheGetLastErrorAPI is returning 2. I am not able to make out the details from the number. Is it possible to get an explanation for the error number. The platform is Win XP. Any working code reference which triggers a console Program will be appreciated.
Thanks and Regards,
Jayaram G
TCHAR szBuf[80];
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL );
wsprintf(szBuf, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf); MessageBox(NULL, szBuf, "Error", MB_OK);
LocalFree(lpMsgBuf);
This code lets you get the error message from windows.
2 = ERROR_FILE_NOT_FOUND, the system can not find the file specified
chech that the file exists an that the path is correct