cannot use "DRAMS"

#include <Windows.h>

int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) {

const auto pClassName = "DRAMS";
//register windows class

WNDCLASSEX wc = { 0 };// EXA WORKS BUT DOESNT BUILD
wc.cbSize = sizeof(wc);
wc.style = CS_OWNDC;
wc.lpfnWndProc = DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hCursor = nullptr;
wc.hIcon = nullptr;
wc.hbrBackground = nullptr;
wc.lpszMenuName = nullptr;
wc.lpszClassName = NULL;//cannot use "DRAMS"???
wc.hIconSm = nullptr;
RegisterClassEx(&wc);
return 0;
}

Error MSB8059 -fsanitize=address (Enable Address Sanitizer) not supported on Debug build configurations. hw3d C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 437
Last edited on
> const auto pClassName = "DRAMS";
Use the string type that WNDCLASSEX actually expects.

Not whatever default standard C++ magics out of thin air by use of the auto keyword.

As salem c alluded to, you probably have UNICODE enabled, so it expects pointers to wide strings.

Post the actual compiler error message that made you suspect something is wrong with "DRAMS" string. The current error you pasted has nothing to do with this.
1-the second error MSB8059 is fixed by changing a project property (so forget about it)
my problem now it look like a Unicode wrong page look the code make error when I use EX version and the window title show garbge chars when I use EXA version
yes it was Unicode set in property I set it to no set and creatwindowEx works now thanks for help guys this discussion open the mind thanks alot
Note that if you want your app to support the wider unicode character set, you will want to use wide strings in Windows. But if you're just trying to get it to work and are fine with it only supporting ASCII, then you're good.
Registered users can post here. Sign in or register to post.