Monday, 4 April 2016

LAB 9:Write a Visual Basic C++ Program to Display the Position of mouse

#include<afxwin.h>


class myframe:public CFrameWnd
{
public:
myframe()
{
Create(NULL,"simple dialog box");
}
void OnLButtonDown(UINT flag,CPoint point)
{
char str [100];
sprintf(str,"%d,%d", point.x, point.y);
MessageBox ( str, "mouse position");
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()

class myapp:public CWinApp
{
public:
BOOL InitInstance()
{
myframe *bwnd;
bwnd=new myframe();
bwnd->ShowWindow(1);
m_pMainWnd=bwnd;
return 1;
}
};
myapp a; 

No comments:

Post a Comment