尝试使用谷歌搜索几个小时,测试不同的解决方案几个小时,但仍然无法使它正常工作。
我需要一个const url base(例如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