Draw String in SmartDevice using VC++ Win32.

Normally we can draw string in VC++ win32 files using the TextOut() function which is in the headerfile wingdi.h.

But, smart device not support the TextOut() function. So we can draw string in smart devices using ExtTextOut(). function only.

Here is an example for how to use ExtTextOut() in VC++ Win32 application....

First we need to include the header file windows.h.

then call the function ExtTextOut() in WM_PAINT event for draw string as follows,

case WM_PAINT:
hdc=BeginPaint(hDlg,&ps);
lpString=L"This is the DrawString test"; // Here lpString is LPCWSTR. Declare in global
ExtTextOut(hdc, 10, 10, ETO_CLIPPED, NULL, lpString, _tcslen(lpString), NULL);
EndPaint(hDlg, &ps);
break;

Just run and get.....

Thats it....

Cheers....

...S.VinothkumaR.

No comments: