shell32: ABM_GETAUTOHIDEBAR should return a HWND or NULL.

This commit is contained in:
Huw Davies 2008-03-05 12:07:05 +00:00 committed by Alexandre Julliard
parent c9c77ba7f7
commit b24ec72f89
2 changed files with 41 additions and 2 deletions

View File

@ -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);

View File

@ -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();
}