tags:

views:

258

answers:

1

Hi i m new to win32 application?

I want to know how to write text on a particular window at the top of the window say for an example (x,y) =(40,10) in this coordinate of a particular window . i have to write text.

A: 

Suppose your window name is "hwnd" and the text which u want to write on that window at x,y coordinate is say stored in "message" where

LPCWSTR message=L"My First Window"; then

RECT rect;
HDC wdc = GetWindowDC(hwnd);
GetClientRect (bgHandle, &rect) ;
SetTextColor(wdc, 0x00000000);
SetBkMode(wdc,TRANSPARENT);
rect.left=40;
rect.top=10;
DrawText( wdc, message, -1, &rect, DT_SINGLELINE | DT_NOCLIP  ) ;
DeleteDC(wdc);  

Thats it.. remember this is just one example.

Abhi