无法将参数2从'const char [5]'转换为'LPCWSTR'

时间:2017-12-27 21:34:04

标签: c++ shellexecute

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)”:不能将//参数2从'const char [5]'转换为'LPCWSTR'

1 个答案:

答案 0 :(得分:1)

调用ShellExecuteA而不是ShellExecute,Windows API有大量的宏来决定ANSI和Unicode版本