DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

STARTUPINFO   StartupInfo;//创建进程所需的信息结构变量   

PROCESS_INFORMATION   ProcessInfo;     

GetStartupInfo(&StartupInfo);    
StartupInfo.lpReserved=NULL;    
StartupInfo.lpDesktop=NULL;    
StartupInfo.lpTitle=NULL;    
StartupInfo.dwX=0;    
StartupInfo.dwY=0;    
StartupInfo.dwXSize=0;    
StartupInfo.dwYSize=0;    
StartupInfo.dwXCountChars=500;    
StartupInfo.dwYCountChars=500;    
StartupInfo.dwFlags=STARTF_USESHOWWINDOW;    
StartupInfo.wShowWindow=SW_HIDE;    
//说明进程将以隐藏的方式在后台执行    
StartupInfo.cbReserved2=0;    
StartupInfo.lpReserved2=NULL;    
StartupInfo.hStdInput=stdin;    
StartupInfo.hStdOutput=stdout;    
StartupInfo.hStdError=stderr;    

BOOL   bRet;    

char *proname = (char *)malloc(256);

proname = "E:\\work\\project0\\spider\\bin\\Release\\spider1.exe";

bRet   =   CreateProcess(proname ,NULL,NULL,NULL,TRUE,CREATE_NO_WINDOW ,NULL,NULL,&StartupInfo,&ProcessInfo);   

WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);

posted on 2019-06-05 14:20  DoubleLi  阅读(1106)  评论(0编辑  收藏  举报