不能将参数2从'const char [5]'转换为'LPCWSTR'[重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

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'

c++ shellexecute
1个回答
1
投票

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

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.