VC++, 重启程序

TCHAR pBuf[MAX_PATH];
 GetModuleFileName(NULL,pBuf,MAX_PATH);
 STARTUPINFO startupinfo;
 PROCESS_INFORMATION proc_info;
 memset(&startupinfo,0,sizeof(STARTUPINFO));
 startupinfo.cb=sizeof(STARTUPINFO);
 PostQuitMessage(0);    //结束自己
 Sleep(500);                   //停500毫秒
 ::CreateProcess(pBuf,NULL,NULL,NULL,FALSE, 
  NORMAL_PRIORITY_CLASS,NULL,NULL,&startupinfo,&proc_info);    //重启自己


posted @ 2013-03-31 15:43  奥雷连诺  阅读(197)  评论(0编辑  收藏  举报