The
WM_MOUSEMOVE
message is posted to the window beneath the mouse cursor when the mouse is not captured. So the message is posted to the control window and not the dialog window when the mouse is over a control.
The solution is to capture the mouse in the dialog window. Then all mouse messages are send to the captured window when the cursor is over the window, or the mouse button was pressed when over the window and the button is still down.
See
CWnd::SetCapture[
^] in the MSDN. The article
Using SetCapture() and ReleaseCapture() correctly (usually during a drag n' drop operation).[
^] may be also useful.