[PATCH] Recalculate menus after WM_INITMENU

gerard patel gerard.patel at asi.fr
Mon Mar 12 16:20:41 CST 2001


StatView (www.statview.com) menus don't work at all.
It seems that this app recreates all submenus of the
main menu in the WM_INITMENU handling.

ChangeLog:

	* controls/menu.c
                   Recalculate menu sizes if WM_INITMENU has recreated/changed something

-------------- next part --------------
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.108
diff -u -r1.108 menu.c
--- controls/menu.c	2001/02/26 22:33:29	1.108
+++ controls/menu.c	2001/03/12 22:09:19
@@ -3016,8 +3016,20 @@
     SendMessageA( hWnd, WM_SETCURSOR, hWnd, HTCAPTION );
 
     if (!(wFlags & TPM_NONOTIFY))
+    {
+       POPUPMENU *menu;
        SendMessageA( hWnd, WM_INITMENU, hMenu, 0 );
-
+       if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height))
+       { /* app changed/recreated menu bar entries in WM_INITMENU
+            Recalculate menu sizes else clicks will not work */
+           RECT r;
+           HDC hdc = GetDCEx( hWnd, 0, DCX_CACHE | DCX_WINDOW );
+           SelectObject( hdc, hMenuFont);
+           GetClientRect(hWnd, &r); /* probably too simple */
+           MENU_MenuBarCalcSize( hdc, &r, menu, hWnd );
+           ReleaseDC(hWnd, hdc);
+       }
+    }
     return TRUE;
 }
 /***********************************************************************
-------------- next part --------------



More information about the wine-patches mailing list