This example starts Notepad, waits for it to be closed, then gets its exit code.
#include <Windows.h>
int main()
{
STARTUPINFOW si = { 0 };
si.cb = sizeof(si);
PROCESS_INFORMATION pi = { 0 };
// Create the child process
BOOL success = CreateProcessW(
L"C:...