【问题标题】:I am getting this error message - a value of type "const char *" cannot be assigned to an entity of type"LPCWSTR"我收到此错误消息 - 无法将类型为 \"const char *\" 的值分配给类型为 \"LPCWSTR\" 的实体
【发布时间】:2022-08-10 01:50:30
【问题描述】:

这些是导致错误的代码行:

    WndClass.lpszClassName = \"WinProg\";

hWindow = CreateWindow(\"WinProg\", \"Window\", WS_OVERLAPPEDWINDOW, 0, 0, 400, 400, NULL, NULL, hInstance, NULL);

我不知道如何“修复”这个错误。

标签: c++ lpcwstr


【解决方案1】:

当构建这样的 UNICODE 前缀字符串文字时 - L“宽字符串文字”,它们应该是 wchar_t,而不是 char。

在您的情况下,它应该是 WndClass.lpszClassName = L"WinProg"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多