The WM_MOUSEMOVE Message is posted to a window when the cursor moves. If the mouse is not currently captured, this message is posted to the window that contains the cursor. If the mouse is captured, the WM_MOUSEMOVE message is posted to the window that has captured the mouse. A window receives this message through the windows procedure function.
Use the following code to obtain the horizontal and vertical position:
xPos = GET_X_LPARAM(lParam);
yPos = GET_Y_LPARAM(lParam);
If an application processes this message, it should return zero.