user32: handle MN_GETHMENU in PopupMenuWndProc

Rein Klazes wijn at online.nl
Fri Oct 16 06:12:33 CDT 2009


see bug #20381
---
 dlls/user32/menu.c       |    1 +
 dlls/user32/tests/menu.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 5960031..a1145a5 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3509,6 +3509,7 @@ static LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
         break;
 
     case MM_GETMENUHANDLE:
+    case MN_GETHMENU:
         return GetWindowLongPtrW( hwnd, 0 );
 
     default:
diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index a388103..7eb4796 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -150,10 +150,12 @@ static int  gflag_initmenupopup,
 static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
         WPARAM wparam, LPARAM lparam)
 {
+    static HMENU hmenupopup;
     switch (msg)
     {
         case WM_INITMENUPOPUP:
             gflag_initmenupopup++;
+            hmenupopup = (HMENU) wparam;
             break;
         case WM_ENTERMENULOOP:
             gflag_entermenuloop++;
@@ -229,6 +231,11 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
             {
                 ok( lparam || broken(!lparam), /* win9x, nt4 */
                     "Menu window handle is NULL!\n");
+                if( lparam) {
+                    HMENU hmenu = SendMessageA( (HWND)lparam, MN_GETHMENU, 0, 0);
+                    ok( hmenupopup == hmenu, "MN_GETHMENU returns %p expected %p\n",
+                        hmenu, hmenupopup);
+                }
                 PostMessage(hwnd, WM_CANCELMODE, 0, 0);
                 return TRUE;
             }
-- 
1.6.3.3




More information about the wine-patches mailing list