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