Experts Exchange connects you with the people and services you need so you can get back to work.
DWORD ExecuteAndWaitForCompletion ( LPSTR pszCmd, BOOL bShow)
DWORD dwCode = 0;
ZeroMemory ( &si, sizeof ( STARTUPINFO));
si.cb = sizeof ( STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = bShow ? SW_SHOWNORMAL : SW_HIDE;
bRes = CreateProcess ( NULL,
while ( WAIT_OBJECT_0 != MsgWaitForMultipleObjects ( 1,
while ( PeekMessage ( &msg, NULL, 0, 0, PM_REMOVE))
DispatchMessage ( &msg);
GetExitCodeProcess ( pi.hProcess, &dwCode);
CloseHandle ( pi.hProcess);
CloseHandle ( pi.hThread);
return ( dwCode);
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $12.50.
Premium members get this course for $37.50.
Premium members get this course for $25.00.
Premium members get this course for $18.75.
Premium members get this course for $259.00.
Premium members get this course for $62.50.
Premium members get this course for $159.20.