Monday, April 19, 2010

left mouse button

DISPLAYING TEXT ON LEFT MOUSE BUTTON CLICK
Step6:Window Procedure
a) WM_LBUTTONDOWN:
i)Get the Device context handle and the coordinates of the client area whenever left mouse
button is clicked.
ii)Draw the text in the client area.
b)WM_DESTROY
Post quit Message that generates WM_QUIT
c) Default:
Other messages are handled by the default window procedure.
long _stdcall WProc (HWND hwnd,UINT x,WPARAM w,LPARAM z)
{
int xi,yi;
HDC d;
switch(x)
{
case WM_LBUTTONDOWN:
x1=LOWORD(z);
y1=HIWORD(z);
d=GetDC(hwnd);
TextOut(d,x1,y1,”HELLO”,5);
ReleaseDC(hwnd,d);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,x,w,l);
}
return 0;
}

No comments:

Post a Comment