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.
Index: controls/menu.c =================================================================== RCS file: /home/wine/wine/controls/menu.c,v retrieving revision 1.171 diff -u -r1.171 menu.c --- controls/menu.c 26 Nov 2003 05:08:48 -0000 1.171 +++ controls/menu.c 4 Dec 2003 22:40:26 -0000 @@ -2724,12 +2724,13 @@ if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) { /* - * Use the mouse coordinates in lParam instead of those in the MSG - * struct to properly handle synthetic messages. They are already - * in screen coordinates. - */ - mt.pt.x = (short)LOWORD(msg.lParam); - mt.pt.y = (short)HIWORD(msg.lParam); + * Need to explicitly get the cursor position in screen coordinates. + * We cannot use the msg.pt value as it may be a synthetic + * message. We ALSO cannot use the msg.lParam value, since + * this is relative to the client area (i.e. not necessarily in screen + * coordinates) + */ + GetCursorPos(&mt.pt); /* Find a menu for this mouse event */ hmenu = MENU_PtMenu( mt.hTopMenu, mt.pt );