Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int _tmain(int argc, _TCHAR* argv[])
- {
- PROCESS_INFORMATION procInf;
- memset(&procInf, 0, sizeof(procInf));
- LPTCHAR process = _T("c:\\windows\\system32\\notepad.exe"); //process to execute
- DWORD creationFlags = CREATE_DEFAULT_ERROR_MODE|CREATE_NEW_CONSOLE|CREATE_SUSPENDED; //create suspended
- printf("Return: %d\n",executeProcess(process,creationFlags,&procInf));
- Sleep(5*1000); //just wait 5 seconds before the process returns
- ResumeThread(procInf.hThread); //resume the main thread, so that the process can run
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment