龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > C/C++开发 >

如何单步执行外部程序

时间:2009-12-22 15:42来源:未知 作者:admin 点击:
分享到:
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",ge

  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);

  

  

}

  

精彩图集

赞助商链接