Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: va!n on June 07, 2012
-
For my Win32 project i want like to draw special chars with something like TextOut()... I will define the special chars as WCHAR and set its HexValue like following codesnip but i cant get it work. Any idea how to solve this? Thanks!
WCHAR testchar = 0x00A9;
TextOut( hdc, 20, 10, TEXT("A"), 1); // Works fine !
TextOut( hdc, 80, 10, (WCHAR)testchar , 2); // Does not work :(
Btw yes, the project is compiled by using unicode charset!
-
WCHAR tc[2]={0};
tc[0]=testchar;
TextOut(,,,tc,2);
TextOut prints strings not characters so you need to make a string.
Jim
-
@Jim:
Cool! Many thanks for your help, it works fantastic now! This problem has cost me some hours ^^
K++
-
if TextOut doesn't need a NULL terminator you could just do..
WCHAR testchar = 0x00A9;
TextOut( hdc, 20, 10, &testchar, 1);
;)
-
@Canopy:
Thanks! I am not sure if TextOut() requires a NULL terminated string or not...
However, it seems to work ;) K++
-
MultiByteToWideChar
This function maps a character string to a wide-character (Unicode) string.
http://msdn.microsoft.com/en-us/library/bb202786.aspx