hi all,
I am new in win32 programming, I try to use in following ways:
case
WM_PAINT:hdc = BeginPaint(hWnd, &ps);
TextOut(hdc,50,50, (LPCTSTR)"H", 2);......etc
It seem to give me some strange chinese character.
How should I cast the lpstring I am using Window XP and visual studio VC++
2005 express edition, PSDK.
Regards,

GDI's TextOut giving strange character
808
Thank you all,
It seem to compile correctly with TextOut(hdc, 50, 50, _T("H"), 2);
Joshua Cole
You could try like
....
TCHAR szText[2]=_T("H");
TextOut(hdc,50,50, szText,_tcslen(szText));
....
Regarding the fourth parameter to "TextOut", below link from MSDN can give you more ideas.
http://msdn.microsoft.com/library/default.asp url=/library/en-us/gdi/fontext_StringLength.asp
Allen Kwan
Hi Surren,
Thank you.
This works too...
TCHAR szText[2]=_T("H");
TextOut(hdc,50,50, szText,_tcslen(szText));
Regards,
Alexon
bigman921
First Question, Do you at least see the "H" and afterwards the funny Chinese character If that's the case you have one too many characters marked for display, change the 2 to a 1.
TextOut(hdc, 50, 50, (LPCTSTR)"H", 1);
If not I use _T("") operator in VS2005.
try TextOut(hdc, 50, 50, _T("H"), 2);
Hope That works
Kindest Regards
Quintin Immelman