NO IMAGE
//呼叫命令列命令而不顯示命令列視窗
BOOL system_hide(const char* CommandLine)
{
SECURITY_ATTRIBUTES   sa;
HANDLE   hRead, hWrite;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
if (!CreatePipe(&hRead, &hWrite, &sa, 0))
{
return   FALSE;
}
STARTUPINFO   si;
PROCESS_INFORMATION   pi;
si.cb = sizeof(STARTUPINFO);
GetStartupInfo(&si);
si.hStdError = hWrite;
si.hStdOutput = hWrite;
si.wShowWindow = SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
//這裡要  右鍵工程 - 屬性 - 常規----字符集改為---- - 多位元組字符集  不然CommandLine形參不匹配
//關鍵步驟,CreateProcess函式引數意義請查閱MSDN   
//生成.box檔案
if (!CreateProcess(NULL, (LPSTR)CommandLine, NULL, NULL, TRUE, NULL, NULL, NULL, &si, &pi))
{
return FALSE;
}
CloseHandle(hWrite);
char   buffer[4096] = { 0 };
DWORD   bytesRead;
while (true)
{
memset(buffer, 0, strlen(buffer));
if (ReadFile(hRead, buffer, 4095, &bytesRead, NULL) == NULL)
break;
Sleep(100);
}
return   TRUE;
}