Question:
I am a programmer familiar with C# & Java and new to C++. I am trying to create an editor in C# WPF for my C++ OpenGL application and I am following these tutorials: Creating OpenGL Windows in WPF and Walkthrough: Host a Win32 Control in WPF. The latter is from Microsoft.This line of code
Helper::ErrorExit(L"RegisterWindowClass");
gives me this error: Argument of type "const wchar_t*" is incompatible with parameter of type "LPTSTR"
. It is the L that is triggering this according to Visual Studio and I don’t exactly know how to fix it.Answer:
TEXT("RegisterWindowClass")
is supposed to be used.Avoid using
L"RegisterWindowClass"
or "RegisterWindowClass"
with parameters of type LPTSTR
.Also change the parameter type to LPCTSTR in
static void ErrorExit(LPCTSTR lpszFunction)
.If you have better answer, please add a comment about this, thank you!