vc判断文件是否存在2

用SHELLEXECUTEINFO和WaitForSingleObject来实现等待ShellExecute中的程序执行完毕的功能。

例:

//ShellExecute(NULL,"open","E:\\进程\\vigorous\\djpeg.exe",totalstr1,"",SW_HIDE); 这是要实现“djpeg.exe"的语句

SHELLEXECUTEINFO ShExecInfo={0}; 

ShExecInfo.cbSize=sizeof(SHELLEXECUTEINFO);

ShExecInfo.fMask=SEE_MASK_NOCLOSEPROCESS; 

ShExecInfo.hwnd=NULL; 

ShExecInfo.lpVerb=NULL; 

ShExecInfo.lpFile="E:\\进程\\vigorous\\djpeg.exe";

ShExecInfo.lpParameters=totalstr1;

ShExecInfo.lpDirectory=NULL; 

ShExecInfo.nShow=SW_HIDE; 

ShExecInfo.hInstApp=NULL;

ShellExecuteEx(&ShExecInfo); 

WaitForSingleObject(ShExecInfo.hProcess,INFINITE); 



qt执行的方法是:

QProcess::startDetached(strParam);

你可能感兴趣的:(vc判断文件是否存在2)