VC 重新启动程序

    当重新要启动本程序的时候,有用的代码


void CServerCenter::Restart(void)
{
    char buf[256];
    ::GetModuleFileName(NULL,buf,sizeof(buf));
    CString strPath = buf;
    ShowWindow(SW_HIDE);//隐藏本对话框
    WinExec(strPath, SW_SHOW);//启动strPath路径下的执行文件
    OnOK();//退出当前执行对话框程序

}

    这样就重新启动了本程序,从头开始。

参考:

http://blog.csdn.net/foreverhuylee/article/details/22311161


你可能感兴趣的:(VC 重新启动程序)