How to initialize LPWSTR with a const string in C++ Win32 API

1 Answer

0 votes
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX

#include <windows.h>

int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    LPWSTR lpwstr = const_cast<LPTSTR>(TEXT("C++ Win32"));
}


/*
Watch:

lpwstr	0x00007ff6840a9bb0 L"C++ Win32"	wchar_t*

*/

 



answered Aug 10, 2024 by avibootz
...