bool CreateProcess(wstring wstrProcessName, wstring wstrParas, ) { WCHAR wszCmd [2048] = {0}; swprintf(wszCmd, L"%ls %ls", wstrProcessName.c_str(), wstrParas.c_str()); int nProcessPriority = BELOW_NORMAL_PRIORITY_CLASS; STARTUPINFOW si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(STARTUPINFOW)); ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); si.cb = sizeof(STARTUPINFOW); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; if (CreateProcessW(NULL, wszCmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE|nProcessPriority, NULL, NULL, &si, &pi)) { return true; } return false; }
沒有留言:
張貼留言