for c++builder,用于VC应该把消息框改一下就可以了
void contour(void){
char ln[100];
int Make;
char str[100]="";
char *tip="不能执行:";
sprintf(ln,"%s\\%s",GetCurrentDir(),"watson.exe");
char path[100];
sprintf(path,"%s",GetCurrentDir());
chdir(path);
//ShowMessage(ln);
STARTUPINFO startinfo;
PROCESS_INFORMATION procInfo;
strcat(str,tip);
strcat(str, ln);
GetStartupInfo(&startinfo);
startinfo.dwFlags =STARTF_USESHOWWINDOW;
startinfo.wShowWindow=SW_HIDE ;
Make=CreateProcess(NULL,ln,NULL,NULL,false,0,NULL,NULL,&startinfo,&procInfo);
if (!Make)
{
MessageBox(NULL, str, "提示", MB_OK);
}
WaitForSingleObject(procInfo.hProcess, INFINITE);
}
本文地址:http://com.8s8s.com/it/it30373.htm