4 * Copyright 2014 David Quintana
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
23 WINE_DEFAULT_DEBUG_CHANNEL(CMenuBandWrap
);
26 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
28 public IObjectWithSite
,
30 public IPersistStream
,
31 public IOleCommandTarget
,
32 public IServiceProvider
,
36 public IWinEventHandler
,
43 HRESULT
InitWrap(IShellMenu
* shellMenu
);
46 CComPtr
<IDeskBand
> m_IDeskBand
;
47 CComPtr
<IDockingWindow
> m_IDockingWindow
;
48 CComPtr
<IOleWindow
> m_IOleWindow
;
49 CComPtr
<IObjectWithSite
> m_IObjectWithSite
;
50 CComPtr
<IInputObject
> m_IInputObject
;
51 CComPtr
<IPersistStream
> m_IPersistStream
;
52 CComPtr
<IPersist
> m_IPersist
;
53 CComPtr
<IOleCommandTarget
> m_IOleCommandTarget
;
54 CComPtr
<IServiceProvider
> m_IServiceProvider
;
55 CComPtr
<IMenuPopup
> m_IMenuPopup
;
56 CComPtr
<IDeskBar
> m_IDeskBar
;
57 CComPtr
<IMenuBand
> m_IMenuBand
;
58 CComPtr
<IShellMenu2
> m_IShellMenu2
;
59 CComPtr
<IShellMenu
> m_IShellMenu
;
60 CComPtr
<IWinEventHandler
> m_IWinEventHandler
;
61 CComPtr
<IShellMenuAcc
> m_IShellMenuAcc
;
67 // *** IDeskBand methods ***
68 virtual HRESULT STDMETHODCALLTYPE
GetBandInfo(DWORD dwBandID
, DWORD dwViewMode
, DESKBANDINFO
*pdbi
);
70 // *** IDockingWindow methods ***
71 virtual HRESULT STDMETHODCALLTYPE
ShowDW(BOOL fShow
);
72 virtual HRESULT STDMETHODCALLTYPE
CloseDW(DWORD dwReserved
);
73 virtual HRESULT STDMETHODCALLTYPE
ResizeBorderDW(LPCRECT prcBorder
, IUnknown
*punkToolbarSite
, BOOL fReserved
);
75 // *** IOleWindow methods ***
76 virtual HRESULT STDMETHODCALLTYPE
GetWindow(HWND
*phwnd
);
77 virtual HRESULT STDMETHODCALLTYPE
ContextSensitiveHelp(BOOL fEnterMode
);
79 // *** IObjectWithSite methods ***
80 virtual HRESULT STDMETHODCALLTYPE
SetSite(IUnknown
*pUnkSite
);
81 virtual HRESULT STDMETHODCALLTYPE
GetSite(REFIID riid
, PVOID
*ppvSite
);
83 // *** IInputObject methods ***
84 virtual HRESULT STDMETHODCALLTYPE
UIActivateIO(BOOL fActivate
, LPMSG lpMsg
);
85 virtual HRESULT STDMETHODCALLTYPE
HasFocusIO();
86 virtual HRESULT STDMETHODCALLTYPE
TranslateAcceleratorIO(LPMSG lpMsg
);
88 // *** IPersistStream methods ***
89 virtual HRESULT STDMETHODCALLTYPE
IsDirty();
90 virtual HRESULT STDMETHODCALLTYPE
Load(IStream
*pStm
);
91 virtual HRESULT STDMETHODCALLTYPE
Save(IStream
*pStm
, BOOL fClearDirty
);
92 virtual HRESULT STDMETHODCALLTYPE
GetSizeMax(ULARGE_INTEGER
*pcbSize
);
94 // *** IPersist methods ***
95 virtual HRESULT STDMETHODCALLTYPE
GetClassID(CLSID
*pClassID
);
97 // *** IOleCommandTarget methods ***
98 virtual HRESULT STDMETHODCALLTYPE
QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
);
99 virtual HRESULT STDMETHODCALLTYPE
Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
);
101 // *** IServiceProvider methods ***
102 virtual HRESULT STDMETHODCALLTYPE
QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
);
104 // *** IMenuPopup methods ***
105 virtual HRESULT STDMETHODCALLTYPE
Popup(POINTL
*ppt
, RECTL
*prcExclude
, MP_POPUPFLAGS dwFlags
);
106 virtual HRESULT STDMETHODCALLTYPE
OnSelect(DWORD dwSelectType
);
107 virtual HRESULT STDMETHODCALLTYPE
SetSubMenu(IMenuPopup
*pmp
, BOOL fSet
);
109 // *** IDeskBar methods ***
110 virtual HRESULT STDMETHODCALLTYPE
SetClient(IUnknown
*punkClient
);
111 virtual HRESULT STDMETHODCALLTYPE
GetClient(IUnknown
**ppunkClient
);
112 virtual HRESULT STDMETHODCALLTYPE
OnPosRectChangeDB(RECT
*prc
);
114 // *** IMenuBand methods ***
115 virtual HRESULT STDMETHODCALLTYPE
IsMenuMessage(MSG
*pmsg
);
116 virtual HRESULT STDMETHODCALLTYPE
TranslateMenuMessage(MSG
*pmsg
, LRESULT
*plRet
);
118 // *** IShellMenu methods ***
119 virtual HRESULT STDMETHODCALLTYPE
Initialize(IShellMenuCallback
*psmc
, UINT uId
, UINT uIdAncestor
, DWORD dwFlags
);
120 virtual HRESULT STDMETHODCALLTYPE
GetMenuInfo(IShellMenuCallback
**ppsmc
, UINT
*puId
, UINT
*puIdAncestor
, DWORD
*pdwFlags
);
121 virtual HRESULT STDMETHODCALLTYPE
SetShellFolder(IShellFolder
*psf
, LPCITEMIDLIST pidlFolder
, HKEY hKey
, DWORD dwFlags
);
122 virtual HRESULT STDMETHODCALLTYPE
GetShellFolder(DWORD
*pdwFlags
, LPITEMIDLIST
*ppidl
, REFIID riid
, void **ppv
);
123 virtual HRESULT STDMETHODCALLTYPE
SetMenu(HMENU hmenu
, HWND hwnd
, DWORD dwFlags
);
124 virtual HRESULT STDMETHODCALLTYPE
GetMenu(HMENU
*phmenu
, HWND
*phwnd
, DWORD
*pdwFlags
);
125 virtual HRESULT STDMETHODCALLTYPE
InvalidateItem(LPSMDATA psmd
, DWORD dwFlags
);
126 virtual HRESULT STDMETHODCALLTYPE
GetState(LPSMDATA psmd
);
127 virtual HRESULT STDMETHODCALLTYPE
SetMenuToolbar(IUnknown
*punk
, DWORD dwFlags
);
129 // *** IWinEventHandler methods ***
130 virtual HRESULT STDMETHODCALLTYPE
OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
131 virtual HRESULT STDMETHODCALLTYPE
IsWindowOwner(HWND hWnd
);
133 // *** IShellMenu2 methods ***
134 virtual HRESULT STDMETHODCALLTYPE
GetSubMenu(THIS
);
135 virtual HRESULT STDMETHODCALLTYPE
SetToolbar(THIS
);
136 virtual HRESULT STDMETHODCALLTYPE
SetMinWidth(THIS
);
137 virtual HRESULT STDMETHODCALLTYPE
SetNoBorder(THIS
);
138 virtual HRESULT STDMETHODCALLTYPE
SetTheme(THIS
);
140 // *** IShellMenuAcc methods ***
141 virtual HRESULT STDMETHODCALLTYPE
GetTop(THIS
);
142 virtual HRESULT STDMETHODCALLTYPE
GetBottom(THIS
);
143 virtual HRESULT STDMETHODCALLTYPE
GetTracked(THIS
);
144 virtual HRESULT STDMETHODCALLTYPE
GetParentSite(THIS
);
145 virtual HRESULT STDMETHODCALLTYPE
GetState(THIS
);
146 virtual HRESULT STDMETHODCALLTYPE
DoDefaultAction(THIS
);
147 virtual HRESULT STDMETHODCALLTYPE
IsEmpty(THIS
);
149 DECLARE_NOT_AGGREGATABLE(CMenuBandWrap
)
150 DECLARE_PROTECT_FINAL_CONSTRUCT()
152 BEGIN_COM_MAP(CMenuBandWrap
)
153 COM_INTERFACE_ENTRY_IID(IID_IDeskBar
, IMenuPopup
)
154 COM_INTERFACE_ENTRY_IID(IID_IShellMenu
, IShellMenu
)
155 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget
, IOleCommandTarget
)
156 COM_INTERFACE_ENTRY_IID(IID_IOleWindow
, IDeskBand
)
157 COM_INTERFACE_ENTRY_IID(IID_IDockingWindow
, IDockingWindow
)
158 COM_INTERFACE_ENTRY_IID(IID_IDeskBand
, IDeskBand
)
159 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite
, IObjectWithSite
)
160 COM_INTERFACE_ENTRY_IID(IID_IInputObject
, IInputObject
)
161 COM_INTERFACE_ENTRY_IID(IID_IPersistStream
, IPersistStream
)
162 COM_INTERFACE_ENTRY_IID(IID_IPersist
, IPersistStream
)
163 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider
, IServiceProvider
)
164 COM_INTERFACE_ENTRY_IID(IID_IMenuPopup
, IMenuPopup
)
165 COM_INTERFACE_ENTRY_IID(IID_IMenuBand
, IMenuBand
)
166 COM_INTERFACE_ENTRY_IID(IID_IShellMenu2
, IShellMenu2
)
167 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler
, IWinEventHandler
)
168 COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc
, IShellMenuAcc
)
173 HRESULT WINAPI
CMenuBand_Wrapper(IShellMenu
* shellMenu
, REFIID riid
, LPVOID
*ppv
)
179 CMenuBandWrap
* site
= new CComObject
<CMenuBandWrap
>();
182 return E_OUTOFMEMORY
;
184 hr
= site
->InitWrap(shellMenu
);
191 hr
= site
->QueryInterface(riid
, ppv
);
199 HRESULT
CMenuBandWrap::InitWrap(IShellMenu
* shellMenu
)
205 m_IShellMenu
= shellMenu
;
207 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IDeskBand
, &m_IDeskBand
));
208 if (FAILED(hr
)) return hr
;
209 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IDockingWindow
, &m_IDockingWindow
));
210 if (FAILED(hr
)) return hr
;
211 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IOleWindow
, &m_IOleWindow
));
212 if (FAILED(hr
)) return hr
;
213 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IObjectWithSite
, &m_IObjectWithSite
));
214 if (FAILED(hr
)) return hr
;
215 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IInputObject
, &m_IInputObject
));
216 if (FAILED(hr
)) return hr
;
217 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IPersistStream
, &m_IPersistStream
));
218 if (FAILED(hr
)) return hr
;
219 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IPersist
, &m_IPersist
));
220 if (FAILED(hr
)) return hr
;
221 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IOleCommandTarget
, &m_IOleCommandTarget
));
222 if (FAILED(hr
)) return hr
;
223 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IServiceProvider
, &m_IServiceProvider
));
224 if (FAILED(hr
)) return hr
;
225 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IMenuPopup
, &m_IMenuPopup
));
226 if (FAILED(hr
)) return hr
;
227 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IDeskBar
, &m_IDeskBar
));
228 if (FAILED(hr
)) return hr
;
229 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IMenuBand
, &m_IMenuBand
));
230 if (FAILED(hr
)) return hr
;
231 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IShellMenu2
, &m_IShellMenu2
));
232 if (FAILED(hr
)) return hr
;
233 hr
= shellMenu
->QueryInterface(IID_PPV_ARG(IWinEventHandler
, &m_IWinEventHandler
));
234 if (FAILED(hr
)) return hr
;
235 //hr = shellMenu->QueryInterface(IID_PPV_ARG(IShellMenuAcc, &m_IShellMenuAcc));
236 m_IShellMenuAcc
= NULL
;
240 CMenuBandWrap::~CMenuBandWrap()
246 // *** IShellMenu2 methods ***
247 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetSubMenu(THIS
)
249 WrapLogEnter("CMenuBandWrap<%p>::GetSubMenu()\n", this);
250 HRESULT hr
= m_IShellMenu2
->GetSubMenu();
251 WrapLogExit("CMenuBandWrap::GetSubMenu()", hr
);
255 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetToolbar(THIS
)
257 WrapLogEnter("CMenuBandWrap<%p>::SetToolbar()\n", this);
258 HRESULT hr
= m_IShellMenu2
->SetToolbar();
259 WrapLogExit("CMenuBandWrap::SetToolbar()", hr
);
263 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetMinWidth(THIS
)
265 WrapLogEnter("CMenuBandWrap<%p>::SetMinWidth()\n", this);
266 HRESULT hr
= m_IShellMenu2
->SetMinWidth();
267 WrapLogExit("CMenuBandWrap::SetMinWidth()", hr
);
271 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetNoBorder(THIS
)
273 WrapLogEnter("CMenuBandWrap<%p>::SetNoBorder()\n", this);
274 HRESULT hr
= m_IShellMenu2
->SetNoBorder();
275 WrapLogExit("CMenuBandWrap::SetNoBorder()", hr
);
279 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetTheme(THIS
)
281 WrapLogEnter("CMenuBandWrap<%p>::SetTheme()\n", this);
282 HRESULT hr
= m_IShellMenu2
->SetTheme();
283 WrapLogExit("CMenuBandWrap::SetTheme()", hr
);
288 // *** IShellMenuAcc methods ***
289 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetTop(THIS
)
291 WrapLogEnter("CMenuBandWrap<%p>::GetTop()\n", this);
292 HRESULT hr
= m_IShellMenuAcc
->GetTop();
293 WrapLogExit("CMenuBandWrap::GetTop()", hr
);
297 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetBottom(THIS
)
299 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
300 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
301 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
305 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetTracked(THIS
)
307 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
308 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
309 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
313 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetParentSite(THIS
)
315 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
316 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
317 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
321 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetState(THIS
)
323 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
324 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
325 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
329 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::DoDefaultAction(THIS
)
331 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
332 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
333 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
337 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::IsEmpty(THIS
)
339 WrapLogEnter("CMenuBandWrap<%p>::GetBottom()\n", this);
340 HRESULT hr
= m_IShellMenuAcc
->GetBottom();
341 WrapLogExit("CMenuBandWrap::GetBottom()", hr
);
345 // *** IDeskBand methods ***
346 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetBandInfo(DWORD dwBandID
, DWORD dwViewMode
, DESKBANDINFO
*pdbi
)
348 WrapLogEnter("CMenuBandWrap<%p>::GetBandInfo(DWORD dwBandID=%d, DWORD dwViewMode=%d, DESKBANDINFO *pdbi=%p)\n", this, dwBandID
, dwViewMode
, pdbi
);
349 HRESULT hr
= m_IDeskBand
->GetBandInfo(dwBandID
, dwViewMode
, pdbi
);
350 WrapLogExit("CMenuBandWrap::GetBandInfo()", hr
);
354 // *** IDockingWindow methods ***
355 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::ShowDW(BOOL fShow
)
357 WrapLogEnter("CMenuBandWrap<%p>::ShowDW(BOOL fShow=%d)\n", this, fShow
);
358 HRESULT hr
= m_IDockingWindow
->ShowDW(fShow
);
359 WrapLogExit("CMenuBandWrap::ShowDW()", hr
);
363 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::CloseDW(DWORD dwReserved
)
365 WrapLogEnter("CMenuBandWrap<%p>::CloseDW(DWORD dwReserved=%d)\n", this, dwReserved
);
366 HRESULT hr
= m_IDockingWindow
->CloseDW(dwReserved
);
367 WrapLogExit("CMenuBandWrap::CloseDW()", hr
);
371 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::ResizeBorderDW(LPCRECT prcBorder
, IUnknown
*punkToolbarSite
, BOOL fReserved
)
373 WrapLogEnter("CMenuBandWrap<%p>::ResizeBorderDW(LPCRECT prcBorder=%p, IUnknown *punkToolbarSite=%p, BOOL fReserved=%d)\n", this, prcBorder
, punkToolbarSite
, fReserved
);
374 if (prcBorder
) WrapLogPre("*prcBorder=%s\n", Wrap(*prcBorder
));
375 HRESULT hr
= m_IDockingWindow
->ResizeBorderDW(prcBorder
, punkToolbarSite
, fReserved
);
376 if (prcBorder
) WrapLogPost("*prcBorder=%s\n", Wrap(*prcBorder
));
377 WrapLogExit("CMenuBandWrap::ResizeBorderDW()", hr
);
381 // *** IOleWindow methods ***
382 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetWindow(HWND
*phwnd
)
384 WrapLogEnter("CMenuBandWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd
);
385 HRESULT hr
= m_IOleWindow
->GetWindow(phwnd
);
386 if (phwnd
) WrapLogPost("*phwnd=%p\n", *phwnd
);
387 WrapLogExit("CMenuBandWrap::GetWindow()", hr
);
390 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::ContextSensitiveHelp(BOOL fEnterMode
)
392 WrapLogEnter("CMenuBandWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode
);
393 HRESULT hr
= m_IOleWindow
->ContextSensitiveHelp(fEnterMode
);
394 WrapLogExit("CMenuBandWrap::ContextSensitiveHelp()", hr
);
398 // *** IWinEventHandler methods ***
399 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
)
401 //WrapLogEnter("CMenuBandWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult);
402 HRESULT hr
= m_IWinEventHandler
->OnWinEvent(hWnd
, uMsg
, wParam
, lParam
, theResult
);
403 //WrapLogExit("CMenuBandWrap::OnWinEvent()", hr);
407 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::IsWindowOwner(HWND hWnd
)
409 //WrapLogEnter("CMenuBandWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd);
410 HRESULT hr
= m_IWinEventHandler
->IsWindowOwner(hWnd
);
411 //WrapLogExit("CMenuBandWrap::IsWindowOwner()", hr);
415 // *** IObjectWithSite methods ***
416 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetSite(IUnknown
*pUnkSite
)
418 WrapLogEnter("CMenuBandWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite
);
419 HRESULT hr
= m_IObjectWithSite
->SetSite(pUnkSite
);
420 WrapLogExit("CMenuBandWrap::SetSite()", hr
);
425 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetSite(REFIID riid
, PVOID
*ppvSite
)
427 WrapLogEnter("CMenuBandWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid
), ppvSite
);
428 HRESULT hr
= m_IObjectWithSite
->GetSite(riid
, ppvSite
);
429 if (ppvSite
) WrapLogPost("*ppvSite=%p\n", *ppvSite
);
430 WrapLogExit("CMenuBandWrap::GetSite()", hr
);
434 // *** IInputObject methods ***
435 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::UIActivateIO(BOOL fActivate
, LPMSG lpMsg
)
437 WrapLogEnter("CMenuBandWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate
, lpMsg
);
438 HRESULT hr
= m_IInputObject
->UIActivateIO(fActivate
, lpMsg
);
439 WrapLogExit("CMenuBandWrap::UIActivateIO()", hr
);
442 CComPtr
<IMenuPopup
> pmp
;
444 hrt
= IUnknown_QueryService(m_site
, SID_SMenuPopup
, IID_PPV_ARG(IMenuPopup
, &pmp
));
448 hrt
= pmp
->SetSubMenu(this, fActivate
);
453 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::HasFocusIO()
455 WrapLogEnter("CMenuBandWrap<%p>::HasFocusIO()\n", this);
456 HRESULT hr
= m_IInputObject
->HasFocusIO();
457 WrapLogExit("CMenuBandWrap::HasFocusIO()", hr
);
461 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::TranslateAcceleratorIO(LPMSG lpMsg
)
463 WrapLogEnter("CMenuBandWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg
);
464 if (lpMsg
) WrapLogPre("*lpMsg=%s\n", Wrap(*lpMsg
));
465 HRESULT hr
= m_IInputObject
->TranslateAcceleratorIO(lpMsg
);
466 WrapLogExit("CMenuBandWrap::TranslateAcceleratorIO()", hr
);
470 // *** IPersistStream methods ***
471 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::IsDirty()
473 WrapLogEnter("CMenuBandWrap<%p>::IsDirty()\n", this);
474 HRESULT hr
= m_IPersistStream
->IsDirty();
475 WrapLogExit("CMenuBandWrap::IsDirty()", hr
);
478 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::Load(IStream
*pStm
)
480 WrapLogEnter("CMenuBandWrap<%p>::Load(IStream *pStm=%p)\n", this, pStm
);
481 HRESULT hr
= m_IPersistStream
->Load(pStm
);
482 WrapLogExit("CMenuBandWrap::Load()", hr
);
485 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::Save(IStream
*pStm
, BOOL fClearDirty
)
487 WrapLogEnter("CMenuBandWrap<%p>::Save(IStream *pStm=%p, BOOL fClearDirty=%d)\n", this, pStm
, fClearDirty
);
488 HRESULT hr
= m_IPersistStream
->Save(pStm
, fClearDirty
);
489 WrapLogExit("CMenuBandWrap::Save()", hr
);
492 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetSizeMax(ULARGE_INTEGER
*pcbSize
)
494 WrapLogEnter("CMenuBandWrap<%p>::GetSizeMax(ULARGE_INTEGER *pcbSize=%p)\n", this, pcbSize
);
495 HRESULT hr
= m_IPersistStream
->GetSizeMax(pcbSize
);
496 WrapLogExit("CMenuBandWrap::GetSizeMax()", hr
);
500 // *** IPersist methods ***
501 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetClassID(CLSID
*pClassID
)
503 WrapLogEnter("CMenuBandWrap<%p>::GetClassID(CLSID *pClassID=%p)\n", this, pClassID
);
504 HRESULT hr
= m_IPersist
->GetClassID(pClassID
);
505 if (pClassID
) WrapLogPost("*pClassID=%s\n", Wrap(*pClassID
));
506 WrapLogExit("CMenuBandWrap::GetClassID()", hr
);
510 // *** IOleCommandTarget methods ***
511 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
513 WrapLogEnter("CMenuBandWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup
, cCmds
, prgCmds
, pCmdText
);
514 HRESULT hr
= m_IOleCommandTarget
->QueryStatus(pguidCmdGroup
, cCmds
, prgCmds
, pCmdText
);
515 if (pguidCmdGroup
) WrapLogPost("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup
));
516 WrapLogExit("CMenuBandWrap::QueryStatus()", hr
);
520 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
522 WrapLogEnter("CMenuBandWrap<%p>::Exec(const GUID *pguidCmdGroup=%p, DWORD nCmdID=%d, DWORD nCmdexecopt=%d, VARIANT *pvaIn=%p, VARIANT *pvaOut=%p)\n", this, pguidCmdGroup
, nCmdID
, nCmdexecopt
, pvaIn
, pvaOut
);
523 if (pguidCmdGroup
) WrapLogPre("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup
));
524 HRESULT hr
= m_IOleCommandTarget
->Exec(pguidCmdGroup
, nCmdID
, nCmdexecopt
, pvaIn
, pvaOut
);
525 WrapLogExit("CMenuBandWrap::Exec()", hr
);
529 // *** IServiceProvider methods ***
530 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
)
532 WrapLogEnter("CMenuBandWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService
), Wrap(riid
), ppvObject
);
534 if (IsEqualIID(guidService
, SID_SMenuBandChild
))
536 WrapLogPre("SID is SID_SMenuBandChild. Using QueryInterface of self instead of wrapped object.\n");
537 HRESULT hr
= this->QueryInterface(riid
, ppvObject
);
540 if (ppvObject
) WrapLogPost("*ppvObject=%p\n", *ppvObject
);
541 WrapLogExit("CMenuBandWrap::QueryService()", hr
);
546 WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
549 else if (IsEqualIID(guidService
, SID_SMenuBandBottom
))
551 WrapLogPre("SID is SID_SMenuBandBottom. Using QueryInterface of self instead of wrapped object.\n");
552 HRESULT hr
= this->QueryInterface(riid
, ppvObject
);
555 if (ppvObject
) WrapLogPost("*ppvObject=%p\n", *ppvObject
);
556 WrapLogExit("CMenuBandWrap::QueryService()", hr
);
561 WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
564 else if (IsEqualIID(guidService
, SID_SMenuBandBottomSelected
))
566 WrapLogPre("SID is SID_SMenuBandBottomSelected. Using QueryInterface of self instead of wrapped object.\n");
567 HRESULT hr
= this->QueryInterface(riid
, ppvObject
);
570 if (ppvObject
) WrapLogPost("*ppvObject=%p\n", *ppvObject
);
571 WrapLogExit("CMenuBandWrap::QueryService()", hr
);
576 WrapLogPre("QueryInterface on wrapper failed. Handing over to innter object.\n");
581 WrapLogPre("SID not identified.\n");
583 HRESULT hr
= m_IServiceProvider
->QueryService(guidService
, riid
, ppvObject
);
584 if (ppvObject
) WrapLogPost("*ppvObject=%p\n", *ppvObject
);
585 WrapLogExit("CMenuBandWrap::QueryService()", hr
);
590 // *** IMenuPopup methods ***
591 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::Popup(POINTL
*ppt
, RECTL
*prcExclude
, MP_POPUPFLAGS dwFlags
)
593 WrapLogEnter("CMenuBandWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt
, prcExclude
, dwFlags
);
594 HRESULT hr
= m_IMenuPopup
->Popup(ppt
, prcExclude
, dwFlags
);
595 WrapLogExit("CMenuBandWrap::Popup()", hr
);
599 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::OnSelect(DWORD dwSelectType
)
601 WrapLogEnter("CMenuBandWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType
);
602 HRESULT hr
= m_IMenuPopup
->OnSelect(dwSelectType
);
603 WrapLogExit("CMenuBandWrap::OnSelect()", hr
);
607 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetSubMenu(IMenuPopup
*pmp
, BOOL fSet
)
609 WrapLogEnter("CMenuBandWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp
, fSet
);
610 HRESULT hr
= m_IMenuPopup
->SetSubMenu(pmp
, fSet
);
611 WrapLogExit("CMenuBandWrap::SetSubMenu()", hr
);
616 // *** IDeskBar methods ***
617 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetClient(IUnknown
*punkClient
)
619 WrapLogEnter("CMenuBandWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient
);
620 HRESULT hr
= m_IDeskBar
->SetClient(punkClient
);
621 WrapLogExit("CMenuBandWrap::SetClient()", hr
);
625 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetClient(IUnknown
**ppunkClient
)
627 WrapLogEnter("CMenuBandWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient
);
628 HRESULT hr
= m_IDeskBar
->GetClient(ppunkClient
);
629 if (ppunkClient
) WrapLogPost("*ppunkClient=%p\n", *ppunkClient
);
630 WrapLogExit("CMenuBandWrap::GetClient()", hr
);
634 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::OnPosRectChangeDB(RECT
*prc
)
636 WrapLogEnter("CMenuBandWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc
);
637 HRESULT hr
= m_IDeskBar
->OnPosRectChangeDB(prc
);
638 if (prc
) WrapLogPost("*prc=%s\n", Wrap(*prc
));
639 WrapLogExit("CMenuBandWrap::OnPosRectChangeDB()", hr
);
644 // *** IMenuBand methods ***
645 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::IsMenuMessage(MSG
*pmsg
)
647 //WrapLogEnter("CMenuBandWrap<%p>::IsMenuMessage(MSG *pmsg=%p)\n", this, pmsg);
648 HRESULT hr
= m_IMenuBand
->IsMenuMessage(pmsg
);
649 //WrapLogExit("CMenuBandWrap::IsMenuMessage()", hr);
653 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::TranslateMenuMessage(MSG
*pmsg
, LRESULT
*plRet
)
655 //WrapLogEnter("CMenuBandWrap<%p>::TranslateMenuMessage(MSG *pmsg=%p, LRESULT *plRet=%p)\n", this, pmsg, plRet);
656 HRESULT hr
= m_IMenuBand
->TranslateMenuMessage(pmsg
, plRet
);
657 //WrapLogExit("CMenuBandWrap::TranslateMenuMessage(*plRet=%d) = %08x\n", *plRet, hr);
661 // *** IShellMenu methods ***
662 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::Initialize(IShellMenuCallback
*psmc
, UINT uId
, UINT uIdAncestor
, DWORD dwFlags
)
664 WrapLogEnter("CMenuBandWrap<%p>::Initialize(IShellMenuCallback *psmc=%p, UINT uId=%u, UINT uIdAncestor=%u, DWORD dwFlags=%08x)\n", this, psmc
, uId
, uIdAncestor
, dwFlags
);
665 HRESULT hr
= m_IShellMenu
->Initialize(psmc
, uId
, uIdAncestor
, dwFlags
);
666 WrapLogExit("CMenuBandWrap::Initialize()", hr
);
670 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetMenuInfo(IShellMenuCallback
**ppsmc
, UINT
*puId
, UINT
*puIdAncestor
, DWORD
*pdwFlags
)
672 WrapLogEnter("CMenuBandWrap<%p>::GetMenuInfo(IShellMenuCallback **ppsmc=%p, UINT *puId=%p, UINT *puIdAncestor=%p, DWORD *pdwFlags=%p)\n", this, ppsmc
, puId
, puIdAncestor
, pdwFlags
);
673 HRESULT hr
= m_IShellMenu
->GetMenuInfo(ppsmc
, puId
, puIdAncestor
, pdwFlags
);
674 if (ppsmc
) WrapLogPost("*ppsmc=%p\n", *ppsmc
);
675 if (puId
) WrapLogPost("*puId=%u\n", *puId
);
676 if (puIdAncestor
) WrapLogPost("*puIdAncestor=%u\n", *puIdAncestor
);
677 if (pdwFlags
) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags
);
678 WrapLogExit("CMenuBandWrap::GetMenuInfo()", hr
);
682 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetShellFolder(IShellFolder
*psf
, LPCITEMIDLIST pidlFolder
, HKEY hKey
, DWORD dwFlags
)
684 WrapLogEnter("CMenuBandWrap<%p>::SetShellFolder(IShellFolder *psf=%p, LPCITEMIDLIST pidlFolder=%p, HKEY hKey=%p, DWORD dwFlags=%08x)\n", this, psf
, pidlFolder
, hKey
, dwFlags
);
685 HRESULT hr
= m_IShellMenu
->SetShellFolder(psf
, pidlFolder
, hKey
, dwFlags
);
686 WrapLogExit("CMenuBandWrap::SetShellFolder()", hr
);
690 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetShellFolder(DWORD
*pdwFlags
, LPITEMIDLIST
*ppidl
, REFIID riid
, void **ppv
)
692 WrapLogEnter("CMenuBandWrap<%p>::GetShellFolder(DWORD *pdwFlags=%p, LPITEMIDLIST *ppidl=%p, REFIID riid=%s, void **ppv=%p)\n", this, pdwFlags
, ppidl
, Wrap(riid
), ppv
);
693 HRESULT hr
= m_IShellMenu
->GetShellFolder(pdwFlags
, ppidl
, riid
, ppv
);
694 if (pdwFlags
) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags
);
695 if (ppidl
) WrapLogPost("*ppidl=%p\n", *ppidl
);
696 if (ppv
) WrapLogPost("*ppv=%p\n", *ppv
);
697 WrapLogExit("CMenuBandWrap::GetShellFolder()", hr
);
701 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetMenu(HMENU hmenu
, HWND hwnd
, DWORD dwFlags
)
703 WrapLogEnter("CMenuBandWrap<%p>::SetMenu(HMENU hmenu=%p, HWND hwnd=%p, DWORD dwFlags=%08x)\n", this, hmenu
, hwnd
, dwFlags
);
704 HRESULT hr
= m_IShellMenu
->SetMenu(hmenu
, hwnd
, dwFlags
);
705 WrapLogExit("CMenuBandWrap::SetMenu()", hr
);
709 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetMenu(HMENU
*phmenu
, HWND
*phwnd
, DWORD
*pdwFlags
)
711 WrapLogEnter("CMenuBandWrap<%p>::GetMenu(HMENU *phmenu=%p, HWND *phwnd=%p, DWORD *pdwFlags=%p)\n", this, phmenu
, phwnd
, pdwFlags
);
712 HRESULT hr
= m_IShellMenu
->GetMenu(phmenu
, phwnd
, pdwFlags
);
713 if (phmenu
) WrapLogPost("*phmenu=%p\n", *phmenu
);
714 if (phwnd
) WrapLogPost("*phwnd=%p\n", *phwnd
);
715 if (pdwFlags
) WrapLogPost("*pdwFlags=%08x\n", *pdwFlags
);
716 WrapLogExit("CMenuBandWrap::GetMenu()", hr
);
720 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::InvalidateItem(LPSMDATA psmd
, DWORD dwFlags
)
722 WrapLogEnter("CMenuBandWrap<%p>::InvalidateItem(LPSMDATA psmd=%p, DWORD dwFlags=%08x)\n", this, psmd
, dwFlags
);
723 HRESULT hr
= m_IShellMenu
->InvalidateItem(psmd
, dwFlags
);
724 WrapLogExit("CMenuBandWrap::InvalidateItem()", hr
);
728 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::GetState(LPSMDATA psmd
)
730 WrapLogEnter("CMenuBandWrap<%p>::GetState(LPSMDATA psmd=%p)\n", this, psmd
);
731 HRESULT hr
= m_IShellMenu
->GetState(psmd
);
732 WrapLogExit("CMenuBandWrap::GetState()", hr
);
736 HRESULT STDMETHODCALLTYPE
CMenuBandWrap::SetMenuToolbar(IUnknown
*punk
, DWORD dwFlags
)
738 WrapLogEnter("CMenuBandWrap<%p>::SetMenuToolbar(IUnknown *punk=%p, DWORD dwFlags=%08x)\n", this, punk
, dwFlags
);
739 HRESULT hr
= m_IShellMenu
->SetMenuToolbar(punk
, dwFlags
);
740 WrapLogExit("CMenuBandWrap::SetMenuToolbar()", hr
);