explorer: Implement ABM_ADD and ABM_REMOVE.

This commit is contained in:
Vincent Povirk 2008-09-02 15:17:09 -05:00 committed by Alexandre Julliard
parent b4c78be585
commit 96f8de0de9
2 changed files with 50 additions and 3 deletions

View File

@ -156,7 +156,7 @@ static void test_setpos(void)
/* ABM_NEW should return FALSE if the window is already registered */
ret = SHAppBarMessage(ABM_NEW, &abd);
todo_wine ok(ret == FALSE, "SHAppBarMessage returned %i\n", ret);
ok(ret == FALSE, "SHAppBarMessage returned %i\n", ret);
do_events();
/* dock window1 to the bottom of the screen */

View File

@ -43,15 +43,62 @@ struct appbar_response
static HWND appbarmsg_window = NULL;
struct appbar_data
{
struct list entry;
HWND hwnd;
UINT callback_msg;
};
static struct list appbars = LIST_INIT(appbars);
static struct appbar_data* get_appbar(HWND hwnd)
{
struct appbar_data* data;
LIST_FOR_EACH_ENTRY(data, &appbars, struct appbar_data, entry)
{
if (data->hwnd == hwnd)
return data;
}
return NULL;
}
static UINT_PTR handle_appbarmessage(DWORD msg, PAPPBARDATA abd)
{
struct appbar_data* data;
switch (msg)
{
case ABM_NEW:
WINE_FIXME("SHAppBarMessage(ABM_NEW, hwnd=%p, callback=%x): stub\n", abd->hWnd, abd->uCallbackMessage);
if (get_appbar(abd->hWnd))
{
/* fail when adding an hwnd the second time */
return FALSE;
}
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct appbar_data));
if (!data)
{
WINE_ERR("out of memory\n");
return FALSE;
}
data->hwnd = abd->hWnd;
data->callback_msg = abd->uCallbackMessage;
list_add_tail(&appbars, &data->entry);
return TRUE;
case ABM_REMOVE:
WINE_FIXME("SHAppBarMessage(ABM_REMOVE, hwnd=%p): stub\n", abd->hWnd);
if ((data = get_appbar(abd->hWnd)))
{
list_remove(&data->entry);
HeapFree(GetProcessHeap(), 0, data);
}
else
WINE_WARN("removing hwnd %p not on the list\n", abd->hWnd);
return TRUE;
case ABM_QUERYPOS:
WINE_FIXME("SHAppBarMessage(ABM_QUERYPOS, hwnd=%p, edge=%x, rc=%s): stub\n", abd->hWnd, abd->uEdge, wine_dbgstr_rect(&abd->rc));