[Message Deleted]
-
[Message Deleted]
-
[Message Deleted]
Kwanalouie wrote:
The problem I have is that when the cursor is at the top of the client window and I click the right mouse button, the value of point.y is around 72 instead of zero. When I use this same code in the OnLeftMouseDown routine, the value of point.y at the top of the Client window is zero.
Because
OnContextMenu point parameter
is inscreen co-ordinates
and your right click handler point is inclient co-ordinates
so callClientToScreen/MapWindowPoints
to convert to screen co-ordinates. That's why it's zero in right click handler and 72 in context menu handler. From MSDN for OnContextMenu point parameter Position of the cursor, in screen coordinates, at the time of the mouse click. From MSDN for OnLButtonDown point parameter Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Thursday, June 5, 2008 11:52 PM
-
Kwanalouie wrote:
The problem I have is that when the cursor is at the top of the client window and I click the right mouse button, the value of point.y is around 72 instead of zero. When I use this same code in the OnLeftMouseDown routine, the value of point.y at the top of the Client window is zero.
Because
OnContextMenu point parameter
is inscreen co-ordinates
and your right click handler point is inclient co-ordinates
so callClientToScreen/MapWindowPoints
to convert to screen co-ordinates. That's why it's zero in right click handler and 72 in context menu handler. From MSDN for OnContextMenu point parameter Position of the cursor, in screen coordinates, at the time of the mouse click. From MSDN for OnLButtonDown point parameter Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.Nibu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
modified on Thursday, June 5, 2008 11:52 PM
Thanks a lot. That did the trick!