这个问题在这里已有答案:
int main() {
string url;
int a;
int b = 0;
cout << "Enter url: ";
cin >> url;
cout << "how many times do you want to open the url?: ";
cin >> a;
while (b<a)
{
ShellExecute(NULL, "open", url.c_str, NULL, NULL, SW_SHOWNORMAL);
b++
}
cin >> a;
}
//给我带来麻烦的部分是“开放部分说它无法转换// itShellExecuteW(HWND,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,INT)”:无法从'const char [5]'转换//参数2到'LPCWSTR'
调用ShellExecuteA而不是ShellExecute,Windows API有大量的宏在ANSI和Unicode版本之间决定