各位的意见我都试过了,没有问题。<br>但我在调试过程中发现了一个现象,就是用winexec调用程序每次必然会成功,<br>但如果改用createprocess则有时成功,有时失败,不知是什么原因。<br>下面是cbc的部分源码,大家给找找原因!!!<br>AnsiString CommandLine1,CurrentDirectory1;<br>TStartupInfo *StartupInfo1=new TStartupInfo;<br>TProcessInformation *ProcessInfo1=new TProcessInformation;<br>CommandLine1="command.com /c /"ind2.exe/"";<br>CurrentDirectory1=GetCurrentDir();<br>StartupInfo1->cb=sizeof(TStartupInfo);<br>StartupInfo1->dwFlags=STARTF_USESHOWWINDOW;<br>StartupInfo1->wShowWindow=SW_SHOW;<br>if(ww=CreateProcess(NULL,CommandLine1.c_str(),NULL,NULL,false,<br> CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,NULL,StartupInfo1,<br> ProcessInfo1)) {<br> WaitForSingleObject(ProcessInfo1->hProcess,INFINITE);<br> //GetExitCodeProcess(ProcessInfo->hProcess,NULL);<br> }