windows C++ 启动其他进程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sz76211822/article/details/81318448
wchar_t wcPath[2048] = {0};
            GetModuleFileNameW(NULL, wcPath, 2048);
            ::PathRemoveFileSpecW(wcPath);
            if(PathIsRootW(wcPath)){
                wsprintf(wcPath + wcslen(wcPath), L"%s", APP_GUIDE);
            }
            else{
                wsprintf(wcPath + wcslen(wcPath), L"\\%s", APP_GUIDE);
            }

            SHELLEXECUTEINFO  ShExecInfo;
            ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
            ShExecInfo.fMask = NULL;
            ShExecInfo.hwnd = NULL;
            ShExecInfo.lpVerb = NULL;
            ShExecInfo.lpFile = wcPath;        // 执行的程序名
            ShExecInfo.lpParameters = NULL;
            ShExecInfo.lpDirectory = NULL;
            ShExecInfo.nShow = SW_SHOWNORMAL;                // 全屏显示这个程序
            ShExecInfo.hInstApp = NULL;
            ShellExecuteEx(&ShExecInfo);

猜你喜欢

转载自blog.csdn.net/sz76211822/article/details/81318448