重启程序

 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 @ 2011-12-19 14:27  奥雷连诺  阅读(159)  评论(0编辑  收藏  举报