VC6,新建一个单文档工程;
把这两个加到视类头文件;
CPoint m_ptOut; //用来保存鼠标坐标
CString strPosition; //用来保存输出的内容
视类CPP的构造函数中初始化,
m_ptOut.x = 0;
m_ptOut.y = 0;
用类向导为视类添加鼠标移动消息处理函数,该函数代码如下;
void CMmView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//this->GetDC()->SetMapMode(MM_HIENGLISH);
m_ptOut.x = point.x;
m_ptOut.y = point.y;
Invalidate();
CView::OnMouseMove(nFlags, point);
}
OnDraw()函数代码如下;
void CMmView::OnDraw(CDC* pDC)
{
CMmDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: a