-1

I'm trying to draw text to a window. Some enough, two things I'm wondering. Why can the tutorial I'm using not put an L"String Here" and I have to?

I'm confused about that, anyway back to the main point, I;m trying to draw text and I'm getting an error.

enter image description here

Jordan Schnur
  • 1,225
  • 3
  • 15
  • 30

2 Answers2

2

If you have UNICODE defined in your project (which you should be default) then you can either use

wstring s = L"Hello, World!";

or the ANSI API for TextOut

TextOutA(hdc, 10, 10, s.c_str(), s.size());

Neal
  • 36
  • 1
1

See the following question:

What does LPCWSTR stand for and how should it be handled with?

Basically, you're trying to convert a regular character string to a wide character string implicitly and it won't allow you to do that. From the top answer:

To get a normal C literal string to assign to a LPCWSTR, you need to prefix it with L

LPCWSTR a = L"TestWindow";

Community
  • 1
  • 1
gled
  • 121
  • 4