[英]C++ ShellExecute a URL
嘗試使用谷歌搜索幾個小時,測試不同的解決方案幾個小時,但仍然無法使它正常工作。
我需要一個常量url基(例如http://www.google.com ),然后需要用戶(例如Mountain Dew)輸入字符串,然后將它們組合起來。 我嘗試將URL設置為LPCWSTR,wstring,wchar_t,並執行了將它們轉換並組合的功能,但我根本無法使用它。
std::string baseUrl = "http://www.google.com/";
std::string userAdd;
getline(std::cin, userAdd)
ShellExecute(NULL, TEXT("open"), baseUrl + userAdd, NULL, NULL, SW_SHOWNORMAL);
從std :: string到const char *沒有自動轉換。
試試這個: (baseUrl + userAdd).c_str()
並嘗試使用ShellExecuteA
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.