2 * SHAppBarMessage implementation
4 * Copyright 2008 Vincent Povirk for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/unicode.h"
24 #include <wine/debug.h>
25 #include "explorer_private.h"
27 #include "wine/list.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(appbar
);
38 struct appbar_response
44 static HWND appbarmsg_window
= NULL
;
46 static UINT_PTR
handle_appbarmessage(DWORD msg
, PAPPBARDATA abd
)
51 WINE_FIXME("SHAppBarMessage(ABM_NEW, hwnd=%p, callback=%x): stub\n", abd
->hWnd
, abd
->uCallbackMessage
);
54 WINE_FIXME("SHAppBarMessage(ABM_REMOVE, hwnd=%p): stub\n", abd
->hWnd
);
57 WINE_FIXME("SHAppBarMessage(ABM_QUERYPOS, hwnd=%p, edge=%x, rc=%s): stub\n", abd
->hWnd
, abd
->uEdge
, wine_dbgstr_rect(&abd
->rc
));
60 WINE_FIXME("SHAppBarMessage(ABM_SETPOS, hwnd=%p, edge=%x, rc=%s): stub\n", abd
->hWnd
, abd
->uEdge
, wine_dbgstr_rect(&abd
->rc
));
63 WINE_FIXME("SHAppBarMessage(ABM_GETSTATE): stub\n");
64 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
65 case ABM_GETTASKBARPOS
:
66 WINE_FIXME("SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=%p): stub\n", abd
->hWnd
);
69 WINE_FIXME("SHAppBarMessage(ABM_ACTIVATE, hwnd=%p, lparam=%lx): stub\n", abd
->hWnd
, abd
->lParam
);
71 case ABM_GETAUTOHIDEBAR
:
72 WINE_FIXME("SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=%p, edge=%x): stub\n", abd
->hWnd
, abd
->uEdge
);
74 case ABM_SETAUTOHIDEBAR
:
75 WINE_FIXME("SHAppBarMessage(ABM_SETAUTOHIDEBAR, hwnd=%p, edge=%x, lparam=%lx): stub\n", abd
->hWnd
, abd
->uEdge
, abd
->lParam
);
77 case ABM_WINDOWPOSCHANGED
:
78 WINE_FIXME("SHAppBarMessage(ABM_WINDOWPOSCHANGED, hwnd=%p): stub\n", abd
->hWnd
);
81 WINE_FIXME("SHAppBarMessage(%x) unimplemented\n", msg
);
86 LRESULT CALLBACK
appbar_wndproc(HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
)
93 struct appbar_cmd cmd
;
98 struct appbar_response
* response
;
100 cds
= (COPYDATASTRUCT
*)lparam
;
101 if (cds
->cbData
!= sizeof(struct appbar_cmd
))
103 CopyMemory(&cmd
, cds
->lpData
, cds
->cbData
);
105 result
= handle_appbarmessage(cds
->dwData
, &cmd
.abd
);
107 return_hproc
= OpenProcess(PROCESS_DUP_HANDLE
, FALSE
, cmd
.return_process
);
108 if (return_hproc
== NULL
)
110 WINE_ERR("couldn't open calling process\n");
114 if (!DuplicateHandle(return_hproc
, cmd
.return_map
, GetCurrentProcess(), &return_map
, 0, FALSE
, DUPLICATE_SAME_ACCESS
))
116 WINE_ERR("couldn't duplicate handle\n");
117 CloseHandle(return_hproc
);
120 CloseHandle(return_hproc
);
122 return_view
= MapViewOfFile(return_map
, FILE_MAP_WRITE
, 0, 0, sizeof(struct appbar_response
));
126 response
= (struct appbar_response
*)return_view
;
127 response
->result
= result
;
128 response
->rc
= cmd
.abd
.rc
;
130 UnmapViewOfFile(return_view
);
133 WINE_ERR("couldn't map view of file\n");
135 CloseHandle(return_map
);
142 return DefWindowProcW(hwnd
, msg
, wparam
, lparam
);
145 void initialize_appbar(void)
148 static const WCHAR classname
[] = {'W','i','n','e','A','p','p','B','a','r',0};
150 /* register the appbar window class */
151 ZeroMemory(&class, sizeof(class));
152 class.cbSize
= sizeof(class);
153 class.lpfnWndProc
= appbar_wndproc
;
154 class.hInstance
= NULL
;
155 class.lpszClassName
= classname
;
157 if (!RegisterClassExW(&class))
159 WINE_ERR("Could not register appbar message window class\n");
163 appbarmsg_window
= CreateWindowW(classname
, classname
, 0, 0, 0, 0, 0, HWND_MESSAGE
, NULL
, NULL
, NULL
);
164 if (!appbarmsg_window
)
166 WINE_ERR("Could not create appbar message window\n");