String being interpretted as Unicode

Started by
3 comments, last by ANuy 18 years, 7 months ago
ok, in my DrawText function, i have learnt that my string is being interpretted as Unicode. the problem with this is the only thing that is drawn is a few little squares i know that if i say: DrawText(NULL, "hello", blah blah blah then i can change it to DrawText(NULL, L"hello", blah blah blah and it will work correctly my problem is, i want to put the DrawText function inside another function, so the string that is to be printed is contained and transferred as char *String and when i am calling the DrawText function, i cannot say LString, or L String so i really don't know what to do is there a way you can tell the DrawText function not to interpret stuff as Unicode with a separate function or macro? if so, how would i call this any help would really be appreciated
Advertisement
DrawText supports both ANSI and Unicode strings.
ID3DXFont::DrawTextA(...)
ID3DXFont::DrawTextW(...)
The string's type is LPCWSTR if UNICODE is defined, LPCTSTR otherwise.
but even when i use DrawTextA the same problem occurs, and can be fixed in the same way
Use UNICODE, it's a good thing. Simply pass your strings in as wchar_t* instead of char*, or better, use std::basic_string<wchar_t>. If you really want to use char*, you can always convert to a unicode string using the API function MultiByteToWideChar.

use LPCWSTR as the string type and pass it to yor own drawtext function, and use DrawTextW to drawtext

This topic is closed to new replies.

Advertisement