Im new to MFC and Im trying to create a quick application on windows to simulate a hardware/computer peripheral that I will later integrate with, when its available,however the hardware will send screen x & y coordinates.
I created a MFC application that captures mouse events & on mouse move event.
I'm able to capture the mouse move events, however the log does NOT show a numerical value for X & Y and instead outputs .cpp file path for X's value & and nothing for Y, strange?
See code snippet below:
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
See the screenshot for log and the app:
How can I output the numerical x & y values?
Thanks
The problem is that your TRACE statement needs a format string.
EXAMPLE:
TRACE(_T("X: %d"), point.x);
You can read more here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.