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); //重启自己
转载于:https://www.cnblogs.com/yuzhould/archive/2013/03/31/4454268.html