在我的程序里如何编一个运行其他程序的程序

解决方案 »

  1.   

    WinExec
    ShellExecute
    CreateProcess
      

  2.   

    WinExec("C:\Program Files\MyApp", ...) ;
    ShellExecute(handle, "explore", path_to_folder, NULL, NULL, SW_SHOWNORMAL);
      

  3.   

    ShellExecute(NULL,"open",g_ExeFileDirectory,NULL,NULL,SW_SHOW);
    ExeFileDirectory是一个CString ,表示路径加文件名;
    // 得到程序的路径
    TCHAR *path = new char[MAX_PATH+1];
    GetModuleFileName(::GetModuleHandle(NULL),path,MAX_PATH);
    CString INIFilePath = path;
    INIFilePath.TrimRight("\\ExceptionService.exe");
    g_ExeFileDirectory = INIFilePath + "\\ExceptionManager.exe";