CreateProcess

0001-01-01

CreateProcess is a WinAPI function that creates a new process.

STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(si);

// Create a new process for notepad.exe
if (CreateProcess(NULL, "notepad.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
    WaitForSingleObject(pi.hProcess, INFINITE);
    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
} else {
    printf("Failed to create process (%d).\n", GetLastError());
 }

Links to this note