Huw Davies : shell32: ABM_GETAUTOHIDEBAR should return a HWND or NULL.

Alexandre Julliard julliard at winehq.org
Wed Mar 5 13:41:15 CST 2008


Module: wine
Branch: master
Commit: b24ec72f89a01f1bdf0d8573e88d25f5bd7b0903
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b24ec72f89a01f1bdf0d8573e88d25f5bd7b0903

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Mar  5 12:07:05 2008 +0000

shell32: ABM_GETAUTOHIDEBAR should return a HWND or NULL.

---

 dlls/shell32/shell32_main.c  |    7 +++++--
 dlls/shell32/tests/systray.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index c53d726..ac9019a 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -882,6 +882,10 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
     int height=data->rc.bottom - data->rc.top;
     RECT rec=data->rc;
 
+    TRACE("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}\n",
+          msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
+          wine_dbgstr_rect(&data->rc), data->lParam);
+
     switch (msg)
     {
     case ABM_GETSTATE:
@@ -894,8 +898,7 @@ UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
         SetActiveWindow(data->hWnd);
         return TRUE;
     case ABM_GETAUTOHIDEBAR:
-        data->hWnd=GetActiveWindow();
-        return TRUE;
+        return 0; /* pretend there is no autohide bar */
     case ABM_NEW:
         /* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
         SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
diff --git a/dlls/shell32/tests/systray.c b/dlls/shell32/tests/systray.c
index 23e1ba3..f1cd62b 100644
--- a/dlls/shell32/tests/systray.c
+++ b/dlls/shell32/tests/systray.c
@@ -75,6 +75,40 @@ void test_cbsize(void)
     ok(!Shell_NotifyIconA(NIM_DELETE, &nidA), "The icon was not deleted\n");
 }
 
+static void test_SHAppBarMessage(void)
+{
+    APPBARDATA abd;
+    HWND hwnd, foregnd;
+
+    memset(&abd, 0xcc, sizeof(abd));
+    abd.cbSize = sizeof(abd);
+    abd.uEdge = ABE_BOTTOM;
+
+    hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
+    ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
+    ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n");
+
+    /* Presumably one can pass a hwnd with ABM_GETAUTOHIDEBAR to specify a monitor.
+       Pass the foreground window and check */
+    foregnd = GetForegroundWindow();
+    if(foregnd)
+    {
+        abd.hWnd = foregnd;
+        hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd);
+        ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd);
+        ok(abd.hWnd == foregnd, "hWnd overwritten\n");
+        if(hwnd)
+        {
+            HMONITOR appbar_mon, foregnd_mon;
+            appbar_mon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
+            foregnd_mon = MonitorFromWindow(foregnd, MONITOR_DEFAULTTONEAREST);
+            ok(appbar_mon == foregnd_mon, "Windows on different monitors\n");
+        }
+    }
+
+    return;
+}
+
 START_TEST(systray)
 {
     WNDCLASSA wc;
@@ -110,4 +144,6 @@ START_TEST(systray)
         DispatchMessageA(&msg);
     }
     DestroyWindow(hMainWnd);
+
+    test_SHAppBarMessage();
 }




More information about the wine-cvs mailing list