1

Not being entirely familiar with programming GUIs in C++ and whatnot, I'm running into a problem where my program will not respond to a left-mouse click after moving/dragging the application window. What should I do to make it work properly? Here is how I am handling the left-click message in the callback function:

case WM_LBUTTONDOWN: { POINT point; GetCursorPos(&point); break; } 
1
  • Post code that actually reproduces this problem. Commented Sep 19, 2011 at 19:33

1 Answer 1

1

The mouse location is included in the message as the LPARAM.

POINT point; point.x = GET_X_LPARAM(lParam); point.y = GET_Y_LPARAM(lParam); 

As documented at MSDN, the point is relative to the upper left corner of the client area. Therefore if you move the window, point will still be relative to your window.

GetCursorPos gets the position of the cursor in screen coordinates. So you would have to compensate for the position of your window on the screen to get a usable position.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.