Program to display a message “Hello” wherever you click the left mouse button in the client area


Display “Hello” wherever you click the left mouse button

#include <afxwin.h>

class myframe:public CFrameWnd

{

public:

myframe()

{

Create(0,”On Single mouse button click”);

}

void OnLButtonDown(UINT flag, CPoint pt)

{

CClientDC d(this);

d.SetTextColor(RGB(0,0,255));

d.TextOut(pt.x,pt.y,”Hello”,5);

}

DECLARE_MESSAGE_MAP()

};

BEGIN_MESSAGE_MAP(myframe,CFrameWnd)

ON_WM_LBUTTONDOWN()

END_MESSAGE_MAP()

class myapp: public CWinApp

{

public:

int InitInstance()

{

myframe *p;

p = new myframe;

p->ShowWindow(1);

m_pMainWnd=p;

return 1;

}

}; myapp a;

Advertisements

One thought on “Program to display a message “Hello” wherever you click the left mouse button in the client area

Comments are closed.