200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > win10系统中启动Edge浏览器带命令行参数

win10系统中启动Edge浏览器带命令行参数

时间:2019-09-06 09:22:57

相关推荐

win10系统中启动Edge浏览器带命令行参数

win10系统中启动Edge浏览器带命令行参数:

start microsoft-edge:

#include <Windows.h>#include <shellapi.h>int main(){SHELLEXECUTEINFO sf = { 0 };sf.cbSize = sizeof(SHELLEXECUTEINFO);sf.lpFile = "microsoft-edge:/";sf.nShow = 1;__debugbreak();// 断点ShellExecuteEx(&sf); // 跟踪调试执行过程return 0;}

命令行编译: cl shell.cpp /link shell32.lib

COM接口启动方式:

#include "windows.h"#include <atlbase.h>#include <atlstr.h>#include <Shobjidl.h>#include "Shellapi.h"int main(){HRESULT hr = E_FAIL;hr = CoInitialize(NULL);CComPtr<IApplicationActivationManager> activationManager;LPCWSTR edgeAUMID = L"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge";//LPCWSTR edgeAUMID = L"Microsoft.Windows.Spartan_cw5n1h2txyewy!Microsoft.Spartan.Spartan";hr = CoCreateInstance(CLSID_ApplicationActivationManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&activationManager));if (SUCCEEDED(hr)){DWORD newProcessId;__debugbreak();hr = activationManager->ActivateApplication(edgeAUMID, L"", AO_NONE, &newProcessId);}else{wprintf(L"Failed to launch Microsoft Edge");}return 0;}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。