www.pudn.com > SCIDE.rar > Utils.cpp
#include "stdafx.h"
#include "SCIDE.h"
#include "Utils.h"
int WinExecAndWait32(LPCTSTR lpszFileName, int nVisibility)
{
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = nVisibility;
if (!CreateProcess(NULL,
(TCHAR*)lpszFileName, // pointer to command line string
NULL, // pointer to process security attributes
NULL, // pointer to thread security attributes
FALSE, // handle inheritance flag
CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS, // creation flags
NULL, // pointer to new environment block
NULL, // pointer to current directory name
&StartupInfo, // pointer to STARTUPINFO
&ProcessInfo)) // pointer to PROCESS_INF
return -1;
else
{
/*
DWORD ref;
MSG msg;
while (GetMessage(&msg, 0, 0, 0))
{
DispatchMessage(&msg);
WaitForSingleObject(ProcessInfo.hProcess, 10);
}
GetExitCodeProcess(ProcessInfo.hProcess, &ref);
return ref;
*/
return 0;
}
}