Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / shdocvw / taskbarlist.c
blob028169584f07e05b1af914c915b264d27fbc7512
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
21 #include "wine/port.h"
22 #include "wine/debug.h"
24 #include "shdocvw.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28 struct taskbar_list
30 const struct ITaskbarListVtbl *lpVtbl;
31 LONG refcount;
34 /* IUnknown methods */
36 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface, REFIID riid, void **object)
38 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
40 if (IsEqualGUID(riid, &IID_ITaskbarList)
41 || IsEqualGUID(riid, &IID_IUnknown))
43 IUnknown_AddRef(iface);
44 *object = iface;
45 return S_OK;
48 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
50 *object = NULL;
51 return E_NOINTERFACE;
54 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface)
56 struct taskbar_list *This = (struct taskbar_list *)iface;
57 ULONG refcount = InterlockedIncrement(&This->refcount);
59 TRACE("%p increasing refcount to %u\n", This, refcount);
61 return refcount;
64 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList *iface)
66 struct taskbar_list *This = (struct taskbar_list *)iface;
67 ULONG refcount = InterlockedDecrement(&This->refcount);
69 TRACE("%p decreasing refcount to %u\n", This, refcount);
71 if (!refcount)
73 HeapFree(GetProcessHeap(), 0, This);
74 SHDOCVW_UnlockModule();
77 return refcount;
80 /* ITaskbarList methods */
82 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList *iface)
84 FIXME("iface %p stub!\n", iface);
86 return E_NOTIMPL;
89 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList *iface, HWND hwnd)
91 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
93 return E_NOTIMPL;
96 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList *iface, HWND hwnd)
98 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
100 return E_NOTIMPL;
103 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList *iface, HWND hwnd)
105 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
107 return E_NOTIMPL;
110 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList *iface, HWND hwnd)
112 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
114 return E_NOTIMPL;
117 static const struct ITaskbarListVtbl taskbar_list_vtbl =
119 /* IUnknown methods */
120 taskbar_list_QueryInterface,
121 taskbar_list_AddRef,
122 taskbar_list_Release,
123 /* ITaskbarList methods */
124 taskbar_list_HrInit,
125 taskbar_list_AddTab,
126 taskbar_list_DeleteTab,
127 taskbar_list_ActivateTab,
128 taskbar_list_SetActiveAlt,
131 HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list)
133 struct taskbar_list *object;
134 HRESULT hr;
136 TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
138 if (outer)
140 WARN("Aggregation not supported\n");
141 *taskbar_list = NULL;
142 return CLASS_E_NOAGGREGATION;
145 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
146 if (!object)
148 ERR("Failed to allocate taskbar list object memory\n");
149 *taskbar_list = NULL;
150 return E_OUTOFMEMORY;
153 object->lpVtbl = &taskbar_list_vtbl;
154 object->refcount = 0;
156 TRACE("Created ITaskbarList %p\n", object);
158 hr = ITaskbarList_QueryInterface((ITaskbarList *)object, riid, taskbar_list);
159 if (FAILED(hr))
161 HeapFree(GetProcessHeap(), 0, object);
162 return hr;
165 SHDOCVW_LockModule();
167 return S_OK;