• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Argument of type “const wchar_t*” is incompatible with parameter of type “LPTSTR”

Resolved: Argument of type “const wchar_t*” is incompatible with parameter of type “LPTSTR”

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

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!

c++
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to separate multiple answers in one column, for multiple columns, by creating extra columns

26/03/2023

Resolved: How to set consistent decimal separators in R data frame?

26/03/2023

Resolved: How to resolve LNK2001 in c++ projects

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.