Guest User

Untitled

a guest
Aug 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. int _tmain(int argc, _TCHAR* argv[])
  2. {
  3. PROCESS_INFORMATION procInf;
  4. memset(&procInf, 0, sizeof(procInf));
  5.  
  6. LPTCHAR process = _T("c:\\windows\\system32\\notepad.exe"); //process to execute
  7. DWORD creationFlags = CREATE_DEFAULT_ERROR_MODE|CREATE_NEW_CONSOLE|CREATE_SUSPENDED; //create suspended
  8.  
  9. printf("Return: %d\n",executeProcess(process,creationFlags,&procInf));
  10. Sleep(5*1000); //just wait 5 seconds before the process returns
  11. ResumeThread(procInf.hThread); //resume the main thread, so that the process can run
  12. system("pause");
  13. return 0;
  14. }
Add Comment
Please, Sign In to add comment