Kunal Aggarwal 0 Newbie Poster
void CScreenCoordDlg::OnMouseMove(UINT nFlags, CPoint p)
{
       GetCursorPos(&p);
       m_ValX = p.x;
       m_ValY = p.y;
       UpdateData(FALSE);
}

I used the following code to get the mouse coordinates on mouse move.
But the problem is as soon as the mouse moves out of the dialog window it stops updating the mouse coordinates.
Although it shows the mouse coordinates with respect to the top left of the screen ,i.e, (0,0), when inside the dialog window, I want the program to work globally, that is, when the mouse is outside the window it should update the coordinates.

Where's the problem, what should be done to overcome it?

I use MFC Visual Studio 2008.