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

/ 3评论 / 453阅读 / 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. grenuenah说道:

    Reference Riyad as Salihin 501 In book reference Introduction, Hadith 501 buy cheap cialis online

  2. grenuenah说道:

    It is particularly effective in reducing symptoms of heart failure, even that brought on by alcoholism is 80 mg of accutane a high dose

  3. VORVOSESK说道:

    began taking Axiron in 2002 canadian pharmacy cialis I m definitely one that doesn t need any more LH pulsing than I already have

发表回复

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