简体   繁体   中英

How to open a URL in default browser using WinINet API in C++?

我正在研究一个 C++ 身份验证代码,它需要在浏览器上打开一个 URL 以输入 OTP,问题是我不知道 Windows 编程,因为我是一个菜鸟,我正在寻找一些专门使用 WinINet 库来打开一个的代码默认浏览器中的 URL,是否有任何链接或代码可以帮助我?

You want ShellExecute

#include <windows.h>`
#include <shellapi.h>

Then to invoke:

ShellExecuteW(NULL, L"open", L"https://www.stackoverflow.com", NULL, NULL, SW_SHOW);  // unicode

OR

ShellExecuteA(NULL, "open", "https://www.stackoverflow.com", NULL, NULL, SW_SHOW);   // ansi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM