Make the menus of Delphi applications work

Michael Kaufmann hallo at michael-kaufmann.ch
Thu Sep 9 12:28:52 CDT 2004


Update: I moved the variable declaration to the top of the function for 
better compiler compatibility.


> This patch fixes the problem that the menus of Delphi applications 
> don't work with WINE.
>
> Changelog:
>  - Made the menus of Delphi applications work
>  - A single menu can be used in multiple windows, but there are some 
> bugs left
>
>
> PS: Please don't commit my patch "Fix for menus assigned to multiple 
> windows". This patch does the same, but changes less code.


-------------- next part --------------
Index: dlls/user/menu.c
===================================================================
RCS file: /home/wine/wine/dlls/user/menu.c,v
retrieving revision 1.1
diff -u -r1.1 menu.c
--- dlls/user/menu.c	31 Aug 2004 01:10:08 -0000	1.1
+++ dlls/user/menu.c	9 Sep 2004 17:06:34 -0000
@@ -2837,6 +2837,8 @@
  */
 static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
 {
+    POPUPMENU *menu;
+    
     TRACE("hwnd=%p hmenu=%p\n", hWnd, hMenu);
 
     HideCaret(0);
@@ -2849,7 +2851,6 @@
 
     if (!(wFlags & TPM_NONOTIFY))
     {
-       POPUPMENU *menu;
        SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 );
        if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height))
        { /* app changed/recreated menu bar entries in WM_INITMENU
@@ -2859,6 +2860,13 @@
 
        }
     }
+    
+    /* This makes the menus of applications built with Delphi work.
+     * It also enables menus to be displayed in more than one window,
+     * but there are some bugs left that need to be fixed in this case.
+     */
+    if ((menu = MENU_GetMenu( hMenu ))) menu->hWnd = hWnd;
+    
     return TRUE;
 }
 /***********************************************************************


More information about the wine-patches mailing list