Processe.c 637 B

12345678910111213141516171819202122
  1. #include "Header.h"
  2. #define PATH "C:\\Users\\ÊóäðÿøîâÄÀ\\source\\repos\\Porcesses\\x64\\Debug\\SecondProcess.exe"
  3. int main() {
  4. system("chcp 1251 > nul");
  5. STARTUPINFO si;
  6. PROCESS_INFORMATION pi;
  7. ZeroMemory(&si, sizeof(si));
  8. si.cb = sizeof(si);
  9. ZeroMemory(&pi, sizeof(pi));
  10. if (!CreateProcessA(PATH, "1", NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
  11. printf("Íå óäàëîñü ñîçäàòü ïðîöåññ. Êîä îøèáêè: %d.\n", GetLastError());
  12. }
  13. WaitForSingleObject(pi.hProcess, INFINITE);
  14. DWORD childexitcode;
  15. GetExitCodeProcess(pi.hProcess, &childexitcode);
  16. CloseHandle(pi.hProcess);
  17. CloseHandle(pi.hThread);
  18. system("pause");
  19. return 0;
  20. }