curl-7.45.0 vc6 win32

https://files.cnblogs.com/files/kekec2/curl-7.45.0.rar.gif

 

int MyCreateProcess(const CString& strCmd)
{
    LPSTR m_Cmd;
    m_Cmd=(LPSTR)(LPCTSTR)strCmd;
    PROCESS_INFORMATION ProcInfo;
    STARTUPINFO StartInfo;
    GetStartupInfo(&StartInfo);
    StartInfo.cb = sizeof(STARTUPINFO); 
    StartInfo.lpReserved = NULL;
    StartInfo.lpReserved2 = NULL;
    StartInfo.cbReserved2 = 0;
    StartInfo.lpDesktop = NULL; 
    //    StartInfo.dwFlags = 0;
    StartInfo.dwFlags = STARTF_USESHOWWINDOW;//隐藏窗口;
    StartInfo.wShowWindow = SW_HIDE; 
    if(!CreateProcess(NULL,m_Cmd, NULL, NULL, FALSE,CREATE_NO_WINDOW|REALTIME_PRIORITY_CLASS, NULL, NULL, &StartInfo, &ProcInfo))
    {
        CString strError="创建进程失败  ";
        strError = strError+m_Cmd;
//        InsertMsg(strError);
    }
    CloseHandle(ProcInfo.hThread);
    WaitForSingleObject(ProcInfo.hProcess, INFINITE);
    DWORD CodeReturn=1;    
    if(!GetExitCodeProcess(ProcInfo.hProcess,&CodeReturn))
    {
//        InsertMsg("获得退出码失败");
    }
    CloseHandle(ProcInfo.hProcess);
    return (int)CodeReturn;
}

 

posted on 2015-10-28 18:05  kekec2  阅读(458)  评论(0编辑  收藏  举报