我是 MFC 的新手,我正在尝试在 Windows 上创建一个快速应用程序来模拟硬件/计算机外围设备,我稍后会在它可用时与之集成,但是硬件将发送屏幕 x 和 y 坐标。
我创建了一个 MFC 应用程序来捕获鼠标事件和鼠标移动事件。
我能够捕获鼠标移动事件,但是日志没有显示 X 和 Y 的数值,而是输出 X 值的 .cpp 文件路径,而 Y 没有输出任何内容,奇怪吗?
请参阅下面的代码片段:
void CRingExampleView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
/*
I also tried declaring a new point POINT p and passing that to GetCursorPos(&p), but still now numerical output
*/
if (GetCursorPos(&point))
{
TRACE("X:", point.x);
TRACE("Y:", point.y);
}
CScrollView::OnMouseMove(nFlags, point);
}
CScrollView::OnMouseMove(nFlags, point);
}//end function
日志和app见截图:
如何输出数字 x 和 y 值?
谢谢
最佳答案
关于c++ - VC++ MFC 应用程序无法记录鼠标数值坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49018019/