[c++]Windows的函数后面加’A‘或’W‘的含义

/ 10,715评论 / 53778阅读 / 0点赞

含义

LPCWSTR stringToLPCWSTR(const std::string& orig)
{
    size_t origsize = orig.length() + 1;
    const size_t newsize = 100;
    size_t convertedChars = 0;
    wchar_t *wcstring = (wchar_t *)malloc(sizeof(wchar_t)*(orig.length()-1));
    mbstowcs_s(&convertedChars, wcstring, origsize, orig.c_str(), _TRUNCATE);
    return wcstring;
}
ShellExecuteA(NULL, "open", "https://blog.coolight.cool/", NULL, NULL, SW_SHOWNORMAL);

string str = "https://blog.coolight.cool/";
ShellExecute(NULL, _T("open"), stringToLPCWSTR(str), NULL, NULL, SW_SHOWNORMAL);

const char link_char[] = "https://blog.coolight.cool/";
ShellExecute(NULL, _T("open"), stringToLPCWSTR(string(link_char)), NULL, NULL, SW_SHOWNORMAL);

ShellExecute(NULL, L"open", CA2W("https://blog.coolight.cool/"), NULL, NULL, SW_SHOWNORMAL);

常见编码格式

见另一篇文章:常见编码格式 / 字节序(大端 / 小端)/ 带BOM

  1. Тут можно преобрести купить огнестойкий сейф в москве сейф москва огнестойкий купить

  2. CurtisTraup说道:

    buy furosemide online cheapest lasix lasix

  3. Your blog has quickly become one of my favorites I always look forward to your new posts and the insights they offer

  4. Lloydlania说道:

    https://kampharm.shop/# kamagra oral jelly

  5. CurtisTraup说道:

    kampharm shop cheapest Kamagra Kam Pharm kamagra oral jelly

  6. Uazrugh说道:

    Как приобрести аттестат о среднем образовании в Москве и других городах
    titanic2ship.com/attestat-za-9-klass-kupit-tsena-v-nur-sultane-astane.html

  7. DennisBob说道:

    cheapest Gabapentin GabaPharm: buy gabapentin india – gabapentin GabaPharm

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注