VC程序中运行其他程序的三种方法(转)

 1 UINT WinExec(LPCSTR lpCmdLine,UINT uCmdShow)

Eg: if(WinExec(“cdplayer.exe”,SW_MAXIMIZE)<=31)
      AfxMessageBox(“运行CD播放器失败”);
Eg: WinExec("winmine.exe",SW_SHOWNORMAL);
WinExec("C:\\WINDOWS\\System32\\sol.exe",SW_SHOWNORMAL);
2. STARTUPINFO stinfo;
     PROCESSINFO procinfo;
   CreateProcess(NULL,”calc.exe”,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,& stinfo, & procinfo);
3.    ShellExecute(handle,”open”,”cdplayer.exe”,NULL,SW_SHOWNORMAL);
Eg:浏览C:\windows文件夹
       ShellExecute(handle,”explore”,”c:\windows”,NULL,NULL,SW_SHOWNORMAL);

可以参考:

http://hi.baidu.com/doggie/blog/item/a33fbc3e792805ff838b136e.html

你可能感兴趣的:(职场,VC,休闲,运行其他程序)