Actually I think the code would work better like this:-
if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
{
mt.pt.x = (short)LOWORD(msg.lParam);
mt.pt.y = (short)HIWORD(msg.lParam);
ClientToScreen(msg.hwnd,&mt.pt);
-----Original Message-----
From: wine-patches-admin(a)winehq.com
[mailto:wine-patches-admin@winehq.com] On Behalf Of Andrew de Quincey
Sent: Friday, 5 December 2003 8:45 AM
To: wine-patches
Subject: menu: nasty bug in menu tracking
In IDA, the menus don't work correctly... as you move down a menu, the
wrong
item is highlighted if you move to a submenu.. after that, the wrong
menu is
opened and other bad things occur.
The problem is that MSG.lParam is NOT necessarily in screen coordinates
(even
though the comment I have removed says they are). As I can't trust the
MSG.pt
either, this means using GetCursorPos() to determine the mouse position
in
screen coordinates.
BTW: MSDN says this about the MSG.lParam value for WM_MOUSEMOVED events:
lParam The low-order word specifies the x-coordinate of the cursor. The
coordinate is
relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The
coordinate
is relative to the upper-left corner of the client area.