mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RSHELL]
* Improve the logging system to allow using the same logger for both windows classes and rshell classes. * Add a wrapper for CMenuSite. * CMenuDeskBar: Reduce the log differences by keeping a cached copy of the client HWND. * CMenuBand: Reduce the log differences by keeping a copy of the top level HWND. Will be used later. CORE-7586 svn path=/branches/shell-experiments/; revision=62253
This commit is contained in:
parent
ea49280564
commit
3b21639530
9 changed files with 1674 additions and 1236 deletions
|
@ -16,6 +16,7 @@ list(APPEND SOURCE
|
|||
wraplog.cpp
|
||||
logging/CMenuBandWrap.cpp
|
||||
logging/CMenuDeskBarWrap.cpp
|
||||
logging/CMenuSiteWrap.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rshell.def)
|
||||
|
||||
add_library(rshell SHARED ${SOURCE})
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
#include <windowsx.h>
|
||||
#include <shlwapi_undoc.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand);
|
||||
|
||||
|
@ -147,6 +148,8 @@ private:
|
|||
|
||||
BOOL m_useBigIcons;
|
||||
|
||||
HWND m_topLevelWindow;
|
||||
|
||||
public:
|
||||
|
||||
// *** IDeskBand methods ***
|
||||
|
@ -463,19 +466,27 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT index, IShellMenu* childShellMenu)
|
|||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUSITE
|
||||
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUDESKBAR
|
||||
hr = CoCreateInstance(CLSID_MenuDeskBar,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#elif WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#else
|
||||
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
hr = pDeskBar->SetClient(pBandSite);
|
||||
if (FAILED(hr))
|
||||
|
@ -868,13 +879,16 @@ HRESULT CMenuSFToolbar::PopupItem(UINT uItem)
|
|||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
#elif WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
#else
|
||||
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(shellMenu, IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
m_menuBand->GetMenuInfo(&psmc, &uId, &uIdAncestor, &flags);
|
||||
|
||||
|
@ -992,26 +1006,26 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetMenu(
|
|||
m_hmenu = hmenu;
|
||||
m_menuOwner;
|
||||
|
||||
HRESULT hResult = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
HRESULT hr = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (m_site)
|
||||
{
|
||||
HWND hwndParent;
|
||||
|
||||
hResult = m_site->GetWindow(&hwndParent);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_site->GetWindow(&hwndParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_staticToolbar->FillToolbar();
|
||||
hr = m_staticToolbar->FillToolbar();
|
||||
}
|
||||
|
||||
return hResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::GetMenu(
|
||||
|
@ -1027,8 +1041,8 @@ HRESULT STDMETHODCALLTYPE CMenuBand::GetMenu(
|
|||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::SetSite(IUnknown *pUnkSite)
|
||||
{
|
||||
HWND hwndParent;
|
||||
HRESULT hResult;
|
||||
HWND hwndParent;
|
||||
HRESULT hr;
|
||||
|
||||
if (m_site != NULL)
|
||||
m_site->Release();
|
||||
|
@ -1037,34 +1051,47 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetSite(IUnknown *pUnkSite)
|
|||
return S_OK;
|
||||
|
||||
hwndParent = NULL;
|
||||
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_site));
|
||||
if (SUCCEEDED(hResult))
|
||||
hr = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_site));
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_site->GetWindow(&hwndParent);
|
||||
m_site->Release();
|
||||
|
||||
hr = m_site->GetWindow(&hwndParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (!::IsWindow(hwndParent))
|
||||
return E_FAIL;
|
||||
|
||||
if (m_staticToolbar != NULL)
|
||||
{
|
||||
hResult = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_staticToolbar->FillToolbar();
|
||||
hr = m_staticToolbar->FillToolbar();
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (m_SFToolbar != NULL)
|
||||
{
|
||||
hResult = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_SFToolbar->FillToolbar();
|
||||
hr = m_SFToolbar->FillToolbar();
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
CComPtr<IOleWindow> pTopLevelWindow;
|
||||
hr = IUnknown_QueryService(m_site, SID_STopLevelBrowser, IID_PPV_ARG(IOleWindow, &pTopLevelWindow));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return pTopLevelWindow->GetWindow(&m_topLevelWindow);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::GetSite(REFIID riid, PVOID *ppvSite)
|
||||
|
@ -1093,17 +1120,17 @@ HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc)
|
|||
SIZE sizeShlFldY = { 0 };
|
||||
HWND hwndStatic = NULL;
|
||||
HWND hwndShlFld = NULL;
|
||||
HRESULT hResult = S_OK;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (m_staticToolbar != NULL)
|
||||
hResult = m_staticToolbar->GetWindow(&hwndStatic);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_staticToolbar->GetWindow(&hwndStatic);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (m_SFToolbar != NULL)
|
||||
hResult = m_SFToolbar->GetWindow(&hwndShlFld);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_SFToolbar->GetWindow(&hwndShlFld);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (hwndStatic == NULL && hwndShlFld == NULL)
|
||||
return E_FAIL;
|
||||
|
@ -1146,17 +1173,17 @@ HRESULT STDMETHODCALLTYPE CMenuBand::GetBandInfo(
|
|||
{
|
||||
HWND hwndStatic = NULL;
|
||||
HWND hwndShlFld = NULL;
|
||||
HRESULT hResult = S_OK;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (m_staticToolbar != NULL)
|
||||
hResult = m_staticToolbar->GetWindow(&hwndStatic);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_staticToolbar->GetWindow(&hwndStatic);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (m_SFToolbar != NULL)
|
||||
hResult = m_SFToolbar->GetWindow(&hwndShlFld);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_SFToolbar->GetWindow(&hwndShlFld);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (hwndStatic == NULL && hwndShlFld == NULL)
|
||||
return E_FAIL;
|
||||
|
@ -1401,26 +1428,26 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetShellFolder(IShellFolder *psf, LPCITEMID
|
|||
m_SFToolbar = new CMenuSFToolbar(this);
|
||||
}
|
||||
|
||||
HRESULT hResult = m_SFToolbar->SetShellFolder(psf, pidlFolder, hKey, dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
HRESULT hr = m_SFToolbar->SetShellFolder(psf, pidlFolder, hKey, dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (m_site)
|
||||
{
|
||||
HWND hwndParent;
|
||||
|
||||
hResult = m_site->GetWindow(&hwndParent);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_site->GetWindow(&hwndParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_SFToolbar->CreateToolbar(hwndParent, m_dwFlags);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_SFToolbar->FillToolbar();
|
||||
hr = m_SFToolbar->FillToolbar();
|
||||
}
|
||||
|
||||
return hResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
|
||||
|
|
|
@ -50,6 +50,8 @@ private:
|
|||
CComPtr<IUnknown> m_Client;
|
||||
CComPtr<IMenuPopup> m_SubMenuParent;
|
||||
|
||||
HWND m_ClientWindow;
|
||||
|
||||
DWORD m_IconSize;
|
||||
HBITMAP m_Banner;
|
||||
|
||||
|
@ -255,7 +257,7 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::TranslateAcceleratorIO(LPMSG lpMsg)
|
|||
HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetClient(IUnknown *punkClient)
|
||||
{
|
||||
CComPtr<IDeskBarClient> pDeskBandClient;
|
||||
HRESULT hResult;
|
||||
HRESULT hr;
|
||||
|
||||
m_Client.Release();
|
||||
|
||||
|
@ -267,15 +269,19 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetClient(IUnknown *punkClient)
|
|||
Create(NULL);
|
||||
}
|
||||
|
||||
hResult = punkClient->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&m_Client));
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &m_Client));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hResult = m_Client->QueryInterface(IID_IDeskBarClient, (VOID**) &pDeskBandClient);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDeskBandClient));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return pDeskBandClient->SetDeskBarSite(static_cast<IDeskBar*>(this));
|
||||
hr = pDeskBandClient->SetDeskBarSite(static_cast<IDeskBar*>(this));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return IUnknown_GetWindow(m_Client, &m_ClientWindow);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetClient(IUnknown **ppunkClient)
|
||||
|
@ -317,17 +323,6 @@ LRESULT CMenuDeskBar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHan
|
|||
|
||||
if (m_Client)
|
||||
{
|
||||
CComPtr<IOleWindow> pOw;
|
||||
hr = m_Client->QueryInterface(IID_PPV_ARG(IOleWindow, &pOw));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("IUnknown_QueryInterface pBs failed: %x\n", hr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWND clientWnd;
|
||||
pOw->GetWindow(&clientWnd);
|
||||
|
||||
RECT rc;
|
||||
|
||||
GetClientRect(&rc);
|
||||
|
@ -339,7 +334,7 @@ LRESULT CMenuDeskBar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHan
|
|||
rc.left += bm.bmWidth;
|
||||
}
|
||||
|
||||
::SetWindowPos(clientWnd, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
|
||||
::SetWindowPos(m_ClientWindow, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -349,14 +344,14 @@ LRESULT CMenuDeskBar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
|
|||
{
|
||||
CComPtr<IWinEventHandler> winEventHandler;
|
||||
LRESULT result;
|
||||
HRESULT hResult;
|
||||
HRESULT hr;
|
||||
|
||||
result = 0;
|
||||
if (m_Client.p != NULL)
|
||||
{
|
||||
hResult = m_Client->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
|
||||
if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
|
||||
hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
|
||||
hr = m_Client->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
|
||||
if (SUCCEEDED(hr) && winEventHandler.p != NULL)
|
||||
hr = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -425,6 +420,9 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup(POINTL *ppt, RECTL *prcExclude, MP
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = dbc->SetModeDBC(1);
|
||||
// Allow it to fail with E_NOTIMPL.
|
||||
|
||||
// No clue about the arg, using anything != 0
|
||||
hr = dbc->UIActivateDBC(TRUE);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -144,6 +144,13 @@ private:
|
|||
#else
|
||||
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
|
||||
|
||||
|
@ -276,13 +283,16 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
|
|||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#elif WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#else
|
||||
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUBAND
|
||||
hr = CMenuBand_Wrapper(pShellMenu, IID_PPV_ARG(IShellMenu, &pShellMenu));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUSITE
|
||||
hr = CoCreateInstance(CLSID_MenuBandSite,
|
||||
|
@ -294,19 +304,27 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
|
|||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUSITE
|
||||
hr = CMenuSite_Wrapper(pBandSite, IID_PPV_ARG(IBandSite, &pBandSite));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
#if USE_SYSTEM_MENUDESKBAR
|
||||
hr = CoCreateInstance(CLSID_MenuDeskBar,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#elif WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#else
|
||||
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#if WRAP_MENUDESKBAR
|
||||
hr = CMenuDeskBar_Wrapper(pDeskBar, IID_PPV_ARG(IDeskBar, &pDeskBar));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
#endif
|
||||
|
||||
CComObject<CShellMenuCallback> *pCallback;
|
||||
hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,414 +1,422 @@
|
|||
/*
|
||||
* Shell Menu Desk Bar
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
class CMenuDeskBarWrap :
|
||||
public CComCoClass<CMenuDeskBarWrap>,
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IOleCommandTarget,
|
||||
public IServiceProvider,
|
||||
public IInputObjectSite,
|
||||
public IInputObject,
|
||||
public IMenuPopup,
|
||||
public IObjectWithSite,
|
||||
public IBanneredBar,
|
||||
public IInitializeObject
|
||||
{
|
||||
public:
|
||||
CMenuDeskBarWrap();
|
||||
~CMenuDeskBarWrap();
|
||||
|
||||
private:
|
||||
IUnknown * m_IUnknown;
|
||||
IMenuPopup * m_IMenuPopup;
|
||||
IOleCommandTarget * m_IOleCommandTarget;
|
||||
IServiceProvider * m_IServiceProvider;
|
||||
IDeskBar * m_IDeskBar;
|
||||
IOleWindow * m_IOleWindow;
|
||||
IInputObjectSite * m_IInputObjectSite;
|
||||
IInputObject * m_IInputObject;
|
||||
IObjectWithSite * m_IObjectWithSite;
|
||||
IBanneredBar * m_IBanneredBar;
|
||||
IInitializeObject * m_IInitializeObject;
|
||||
|
||||
public:
|
||||
// *** IMenuPopup methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetIconSize(DWORD iIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD* piIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBitmap(HBITMAP hBitmap);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP* phBitmap);
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Initialize(THIS);
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
|
||||
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus);
|
||||
|
||||
// *** IInputObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuDeskBarWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(CMenuDeskBarWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT CMenuDeskBar_Wrapper(REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuDeskBarWrap * deskbar = new CComObject<CMenuDeskBarWrap>();
|
||||
|
||||
if (!deskbar)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HRESULT hr = deskbar->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED(hr))
|
||||
deskbar->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuDeskBarWrap::CMenuDeskBarWrap()
|
||||
{
|
||||
WrapLogOpen();
|
||||
|
||||
CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
|
||||
m_IMenuPopup->QueryInterface(IID_PPV_ARG(IUnknown, &m_IUnknown));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IDeskBar, &m_IDeskBar));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar));
|
||||
m_IUnknown->QueryInterface(IID_PPV_ARG(IInitializeObject, &m_IInitializeObject));
|
||||
}
|
||||
|
||||
CMenuDeskBarWrap::~CMenuDeskBarWrap()
|
||||
{
|
||||
m_IUnknown->Release();
|
||||
m_IMenuPopup->Release();
|
||||
m_IOleCommandTarget->Release();
|
||||
m_IServiceProvider->Release();
|
||||
m_IDeskBar->Release();
|
||||
m_IOleWindow->Release();
|
||||
m_IInputObjectSite->Release();
|
||||
m_IInputObject->Release();
|
||||
m_IObjectWithSite->Release();
|
||||
m_IBanneredBar->Release();
|
||||
m_IInitializeObject->Release();
|
||||
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// *** IMenuPopup methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags);
|
||||
HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags);
|
||||
WrapLogExit("CMenuDeskBarWrap::Popup() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnSelect(DWORD dwSelectType)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType);
|
||||
HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnSelect() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet);
|
||||
HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSubMenu() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetWindow() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuDeskBarWrap::ContextSensitiveHelp() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSite(IUnknown *pUnkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite);
|
||||
HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSite() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetSite(REFIID riid, PVOID *ppvSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite);
|
||||
HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite);
|
||||
if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetSite() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetIconSize(DWORD iIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetIconSize(DWORD iIcon=%d)\n", this, iIcon);
|
||||
HRESULT hr = m_IBanneredBar->SetIconSize(iIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetIconSize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetIconSize(DWORD* piIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetIconSize(DWORD* piIcon=%p)\n", this, piIcon);
|
||||
HRESULT hr = m_IBanneredBar->GetIconSize(piIcon);
|
||||
if (piIcon) WrapLogMsg("*piIcon=%d\n", *piIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetIconSize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetBitmap(HBITMAP hBitmap=%p)\n", this, hBitmap);
|
||||
HRESULT hr = m_IBanneredBar->SetBitmap(hBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetBitmap() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetBitmap(HBITMAP* phBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetBitmap(HBITMAP* phBitmap=%p)\n", this, phBitmap);
|
||||
HRESULT hr = m_IBanneredBar->GetBitmap(phBitmap);
|
||||
if (phBitmap) WrapLogMsg("*phBitmap=%p\n", *phBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetBitmap() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Initialize(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Initialize()\n", this);
|
||||
HRESULT hr = m_IInitializeObject->Initialize();
|
||||
WrapLogExit("CMenuDeskBarWrap::Initialize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryStatus() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%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);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuDeskBarWrap::Exec() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
|
||||
if (IsEqualIID(guidService, SID_SMenuPopup))
|
||||
{
|
||||
WrapLogMsg("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_SMenuBandParent))
|
||||
{
|
||||
WrapLogMsg("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_STopLevelBrowser))
|
||||
{
|
||||
WrapLogMsg("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("SID not identified. Calling wrapped object's QueryService.\n");
|
||||
}
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus);
|
||||
HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnFocusChangeIS() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::UIActivateIO(BOOL bActivating, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::UIActivateIO(BOOL bActivating=%d, LPMSG lpMsg=%p)\n", this, bActivating, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(bActivating, lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::UIActivateIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::HasFocusIO(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuDeskBarWrap::HasFocusIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::TranslateAcceleratorIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetClient(IUnknown *punkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient);
|
||||
HRESULT hr = m_IDeskBar->SetClient(punkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetClient() = %08x\n", hr);
|
||||
|
||||
CComPtr<IDeskBarClient> dbc;
|
||||
punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
|
||||
dbc->SetDeskBarSite(static_cast<IDeskBar*>(this));
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetClient(IUnknown **ppunkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient);
|
||||
HRESULT hr = m_IDeskBar->GetClient(ppunkClient);
|
||||
if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetClient() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnPosRectChangeDB(LPRECT prc)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc);
|
||||
HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc);
|
||||
if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuDeskBarWrap::OnPosRectChangeDB() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
/*
|
||||
* Shell Menu Desk Bar
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
class CMenuDeskBarWrap :
|
||||
public CComCoClass<CMenuDeskBarWrap>,
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IOleCommandTarget,
|
||||
public IServiceProvider,
|
||||
public IInputObjectSite,
|
||||
public IInputObject,
|
||||
public IMenuPopup,
|
||||
public IObjectWithSite,
|
||||
public IBanneredBar,
|
||||
public IInitializeObject
|
||||
{
|
||||
public:
|
||||
CMenuDeskBarWrap() {}
|
||||
~CMenuDeskBarWrap();
|
||||
|
||||
HRESULT InitWrap(IDeskBar * shellMenu);
|
||||
|
||||
private:
|
||||
CComPtr<IMenuPopup > m_IMenuPopup;
|
||||
CComPtr<IOleCommandTarget > m_IOleCommandTarget;
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
CComPtr<IDeskBar > m_IDeskBar;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IInputObjectSite > m_IInputObjectSite;
|
||||
CComPtr<IInputObject > m_IInputObject;
|
||||
CComPtr<IObjectWithSite > m_IObjectWithSite;
|
||||
CComPtr<IBanneredBar > m_IBanneredBar;
|
||||
CComPtr<IInitializeObject > m_IInitializeObject;
|
||||
|
||||
public:
|
||||
// *** IMenuPopup methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetIconSize(DWORD iIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD* piIcon);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBitmap(HBITMAP hBitmap);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP* phBitmap);
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE Initialize(THIS);
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
|
||||
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus);
|
||||
|
||||
// *** IInputObject methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS);
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuDeskBarWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(CMenuDeskBarWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IMenuPopup)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT CMenuDeskBar_Wrapper(IDeskBar * deskBar, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuDeskBarWrap * bar = new CComObject<CMenuDeskBarWrap>();
|
||||
if (!bar)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = bar->InitWrap(deskBar);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
bar->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = bar->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED(hr))
|
||||
bar->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMenuDeskBarWrap::InitWrap(IDeskBar * deskBar)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_IDeskBar = deskBar;
|
||||
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_IMenuPopup));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &m_IObjectWithSite));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IBanneredBar, &m_IBanneredBar));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = deskBar->QueryInterface(IID_PPV_ARG(IInitializeObject, &m_IInitializeObject));
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuDeskBarWrap::~CMenuDeskBarWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// *** IMenuPopup methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Popup(POINTL *ppt=%p, RECTL *prcExclude=%p, MP_POPUPFLAGS dwFlags=%08x)\n", this, ppt, prcExclude, dwFlags);
|
||||
HRESULT hr = m_IMenuPopup->Popup(ppt, prcExclude, dwFlags);
|
||||
WrapLogExit("CMenuDeskBarWrap::Popup() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnSelect(DWORD dwSelectType)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnSelect(DWORD dwSelectType=%08x)\n", this, dwSelectType);
|
||||
HRESULT hr = m_IMenuPopup->OnSelect(dwSelectType);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnSelect() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSubMenu(IMenuPopup *pmp, BOOL fSet)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSubMenu(IMenuPopup *pmp=%p, BOOL fSet=%d)\n", this, pmp, fSet);
|
||||
HRESULT hr = m_IMenuPopup->SetSubMenu(pmp, fSet);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSubMenu() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetWindow() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuDeskBarWrap::ContextSensitiveHelp() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IObjectWithSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetSite(IUnknown *pUnkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetSite(IUnknown *pUnkSite=%p)\n", this, pUnkSite);
|
||||
HRESULT hr = m_IObjectWithSite->SetSite(pUnkSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetSite() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetSite(REFIID riid, PVOID *ppvSite)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetSite(REFIID riid=%s, PVOID *ppvSite=%p)\n", this, Wrap(riid), ppvSite);
|
||||
HRESULT hr = m_IObjectWithSite->GetSite(riid, ppvSite);
|
||||
if (ppvSite) WrapLogMsg("*ppvSite=%p\n", *ppvSite);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetSite() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IBanneredBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetIconSize(DWORD iIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetIconSize(DWORD iIcon=%d)\n", this, iIcon);
|
||||
HRESULT hr = m_IBanneredBar->SetIconSize(iIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetIconSize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetIconSize(DWORD* piIcon)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetIconSize(DWORD* piIcon=%p)\n", this, piIcon);
|
||||
HRESULT hr = m_IBanneredBar->GetIconSize(piIcon);
|
||||
if (piIcon) WrapLogMsg("*piIcon=%d\n", *piIcon);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetIconSize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetBitmap(HBITMAP hBitmap=%p)\n", this, hBitmap);
|
||||
HRESULT hr = m_IBanneredBar->SetBitmap(hBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetBitmap() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetBitmap(HBITMAP* phBitmap)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetBitmap(HBITMAP* phBitmap=%p)\n", this, phBitmap);
|
||||
HRESULT hr = m_IBanneredBar->GetBitmap(phBitmap);
|
||||
if (phBitmap) WrapLogMsg("*phBitmap=%p\n", *phBitmap);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetBitmap() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
// *** IInitializeObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Initialize(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::Initialize()\n", this);
|
||||
HRESULT hr = m_IInitializeObject->Initialize();
|
||||
WrapLogExit("CMenuDeskBarWrap::Initialize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryStatus() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%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);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuDeskBarWrap::Exec() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
|
||||
if (IsEqualIID(guidService, SID_SMenuPopup))
|
||||
{
|
||||
WrapLogMsg("SID is SID_SMenuPopup. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_SMenuBandParent))
|
||||
{
|
||||
WrapLogMsg("SID is SID_SMenuBandParent. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else if (IsEqualIID(guidService, SID_STopLevelBrowser))
|
||||
{
|
||||
WrapLogMsg("SID is SID_STopLevelBrowser. Using QueryInterface of self instead of wrapped object.\n");
|
||||
HRESULT hr = this->QueryInterface(riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("QueryInterface on wrapper failed. Handing over to innter object.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WrapLogMsg("SID not identified. Calling wrapped object's QueryService.\n");
|
||||
}
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuDeskBarWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus);
|
||||
HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus);
|
||||
WrapLogExit("CMenuDeskBarWrap::OnFocusChangeIS() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::UIActivateIO(BOOL bActivating, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::UIActivateIO(BOOL bActivating=%d, LPMSG lpMsg=%p)\n", this, bActivating, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(bActivating, lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::UIActivateIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::HasFocusIO(THIS)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuDeskBarWrap::HasFocusIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuDeskBarWrap::TranslateAcceleratorIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBar methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::SetClient(IUnknown *punkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::SetClient(IUnknown *punkClient=%p)\n", this, punkClient);
|
||||
HRESULT hr = m_IDeskBar->SetClient(punkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::SetClient() = %08x\n", hr);
|
||||
|
||||
CComPtr<IDeskBarClient> dbc;
|
||||
punkClient->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
|
||||
dbc->SetDeskBarSite(static_cast<IDeskBar*>(this));
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::GetClient(IUnknown **ppunkClient)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::GetClient(IUnknown **ppunkClient=%p)\n", this, ppunkClient);
|
||||
HRESULT hr = m_IDeskBar->GetClient(ppunkClient);
|
||||
if (ppunkClient) WrapLogMsg("*ppunkClient=%p\n", *ppunkClient);
|
||||
WrapLogExit("CMenuDeskBarWrap::GetClient() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBarWrap::OnPosRectChangeDB(LPRECT prc)
|
||||
{
|
||||
WrapLogEnter("CMenuDeskBarWrap<%p>::OnPosRectChangeDB(RECT *prc=%p)\n", this, prc);
|
||||
HRESULT hr = m_IDeskBar->OnPosRectChangeDB(prc);
|
||||
if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuDeskBarWrap::OnPosRectChangeDB() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
|
366
base/shell/rshell/logging/CMenuSiteWrap.cpp
Normal file
366
base/shell/rshell/logging/CMenuSiteWrap.cpp
Normal file
|
@ -0,0 +1,366 @@
|
|||
/*
|
||||
* Shell Menu Site
|
||||
*
|
||||
* Copyright 2014 David Quintana
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "wraplog.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(menusite);
|
||||
|
||||
class CMenuSiteWrap :
|
||||
public CComCoClass<CMenuSiteWrap>,
|
||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||
public IBandSite,
|
||||
public IDeskBarClient,
|
||||
public IOleCommandTarget,
|
||||
public IInputObject,
|
||||
public IInputObjectSite,
|
||||
public IWinEventHandler,
|
||||
public IServiceProvider
|
||||
{
|
||||
public:
|
||||
CMenuSiteWrap() {}
|
||||
~CMenuSiteWrap();
|
||||
|
||||
HRESULT InitWrap(IBandSite * bandSite);
|
||||
|
||||
private:
|
||||
CComPtr<IBandSite > m_IBandSite;
|
||||
CComPtr<IDeskBarClient > m_IDeskBarClient;
|
||||
CComPtr<IOleWindow > m_IOleWindow;
|
||||
CComPtr<IOleCommandTarget> m_IOleCommandTarget;
|
||||
CComPtr<IInputObject > m_IInputObject;
|
||||
CComPtr<IInputObjectSite > m_IInputObjectSite;
|
||||
CComPtr<IWinEventHandler > m_IWinEventHandler;
|
||||
CComPtr<IServiceProvider > m_IServiceProvider;
|
||||
|
||||
public:
|
||||
// IBandSite
|
||||
virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown * punk);
|
||||
virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD* pdwBandID);
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo);
|
||||
virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
|
||||
|
||||
// IDeskBarClient
|
||||
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
|
||||
virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState);
|
||||
|
||||
// IOleWindow
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
||||
|
||||
// IOleCommandTarget
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
|
||||
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID * pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
||||
|
||||
// IInputObject
|
||||
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
|
||||
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
|
||||
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
||||
|
||||
// IInputObjectSite
|
||||
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
|
||||
|
||||
// IWinEventHandler
|
||||
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
||||
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CMenuSiteWrap)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
BEGIN_COM_MAP(CMenuSiteWrap)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
|
||||
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
extern "C"
|
||||
HRESULT CMenuSite_Wrapper(IBandSite * bandSite, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
CMenuSiteWrap * site = new CComObject<CMenuSiteWrap>();
|
||||
|
||||
if (!site)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = site->InitWrap(bandSite);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
site->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = site->QueryInterface(riid, ppv);
|
||||
|
||||
if (FAILED(hr))
|
||||
site->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CMenuSiteWrap::InitWrap(IBandSite * bandSite)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
WrapLogOpen();
|
||||
|
||||
m_IBandSite = bandSite;
|
||||
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &m_IDeskBarClient));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_IOleWindow));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &m_IOleCommandTarget));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObject, &m_IInputObject));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IInputObjectSite, &m_IInputObjectSite));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_IWinEventHandler));
|
||||
if (FAILED(hr)) return hr;
|
||||
hr = bandSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &m_IServiceProvider));
|
||||
return hr;
|
||||
}
|
||||
|
||||
CMenuSiteWrap::~CMenuSiteWrap()
|
||||
{
|
||||
WrapLogClose();
|
||||
}
|
||||
|
||||
// IBandSite
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::AddBand(IUnknown * punk)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::AddBand(IUnknown * punk=%p)\n", this, punk);
|
||||
HRESULT hr = m_IBandSite->AddBand(punk);
|
||||
WrapLogExit("CMenuSiteWrap::AddBand() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::EnumBands(UINT uBand, DWORD* pdwBandID)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::EnumBands(UINT uBand=%u, DWORD* pdwBandID=%p)\n", this, uBand, pdwBandID);
|
||||
HRESULT hr = m_IBandSite->EnumBands(uBand, pdwBandID);
|
||||
if (pdwBandID) WrapLogMsg("*pdwBandID=%d\n", *pdwBandID);
|
||||
WrapLogExit("CMenuSiteWrap::EnumBands() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryBand(DWORD dwBandID=%d, IDeskBand **ppstb=%p, DWORD *pdwState=%p, LPWSTR pszName=%p, int cchName=%p)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
|
||||
HRESULT hr = m_IBandSite->QueryBand(dwBandID, ppstb, pdwState, pszName, cchName);
|
||||
if (ppstb) WrapLogMsg("*ppstb=%p\n", *ppstb);
|
||||
if (pdwState) WrapLogMsg("*pdwState=%d\n", *pdwState);
|
||||
WrapLogExit("CMenuSiteWrap::QueryBand() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)\n", this, dwBandID, riid, ppv);
|
||||
HRESULT hr = m_IBandSite->GetBandObject(dwBandID, riid, ppv);
|
||||
if (ppv) WrapLogMsg("*ppv=%p\n", *ppv);
|
||||
WrapLogExit("CMenuSiteWrap::GetBandObject() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetBandSiteInfo(BANDSITEINFO *pbsinfo=%p)\n", this, pbsinfo);
|
||||
HRESULT hr = m_IBandSite->GetBandSiteInfo(pbsinfo);
|
||||
if (pbsinfo) WrapLogMsg("*pbsinfo=%p\n", *pbsinfo);
|
||||
WrapLogExit("CMenuSiteWrap::GetBandSiteInfo() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::RemoveBand(DWORD dwBandID)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::RemoveBand(DWORD dwBandID=%d)\n", this, dwBandID);
|
||||
HRESULT hr = m_IBandSite->RemoveBand(dwBandID);
|
||||
WrapLogExit("CMenuSiteWrap::RemoveBand() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetBandSiteInfo(const BANDSITEINFO *pbsinfo=%p)\n", this, pbsinfo);
|
||||
//if (phwnd) WrapLogMsg("*pbsinfo=%s\n", Wrap(*pbsinfo));
|
||||
HRESULT hr = m_IBandSite->SetBandSiteInfo(pbsinfo);
|
||||
WrapLogExit("CMenuSiteWrap::SetBandSiteInfo() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetBandState(DWORD dwBandID=%d, DWORD dwMask=%08x, DWORD dwState=%d)\n", this, dwBandID, dwMask, dwState);
|
||||
HRESULT hr = m_IBandSite->SetBandState(dwBandID, dwMask, dwState);
|
||||
WrapLogExit("CMenuSiteWrap::SetBandState() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IDeskBarClient ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetDeskBarSite(IUnknown *punkSite)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetDeskBarSite(IUnknown *punkSite=%p)\n", this, punkSite);
|
||||
HRESULT hr = m_IDeskBarClient->SetDeskBarSite(punkSite);
|
||||
if (punkSite) WrapLogMsg("*punkSite=%p\n", *punkSite);
|
||||
WrapLogExit("CMenuSiteWrap::SetDeskBarSite() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::SetModeDBC(DWORD dwMode)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::SetModeDBC(DWORD dwMode=%d)\n", this, dwMode);
|
||||
HRESULT hr = m_IDeskBarClient->SetModeDBC(dwMode);
|
||||
WrapLogExit("CMenuSiteWrap::SetModeDBC() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetSize(DWORD dwWhich, LPRECT prc)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetSize(DWORD dwWhich=%d, LPRECT prc=%p)\n", this, dwWhich, prc);
|
||||
HRESULT hr = m_IDeskBarClient->GetSize(dwWhich, prc);
|
||||
if (prc) WrapLogMsg("*prc=%s\n", Wrap(*prc));
|
||||
WrapLogExit("CMenuSiteWrap::GetSize() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::UIActivateDBC(DWORD dwState)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::UIActivateDBC(DWORD dwState=%d)\n", this, dwState);
|
||||
HRESULT hr = m_IDeskBarClient->UIActivateDBC(dwState);
|
||||
WrapLogExit("CMenuSiteWrap::UIActivateDBC() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleWindow methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::GetWindow(HWND *phwnd)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::GetWindow(HWND *phwnd=%p)\n", this, phwnd);
|
||||
HRESULT hr = m_IOleWindow->GetWindow(phwnd);
|
||||
if (phwnd) WrapLogMsg("*phwnd=%p\n", *phwnd);
|
||||
WrapLogExit("CMenuSiteWrap::GetWindow() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::ContextSensitiveHelp(BOOL fEnterMode)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::ContextSensitiveHelp(BOOL fEnterMode=%d)\n", this, fEnterMode);
|
||||
HRESULT hr = m_IOleWindow->ContextSensitiveHelp(fEnterMode);
|
||||
WrapLogExit("CMenuSiteWrap::ContextSensitiveHelp() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IOleCommandTarget methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryStatus(const GUID *pguidCmdGroup=%p, ULONG cCmds=%u, prgCmds=%p, pCmdText=%p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
HRESULT hr = m_IOleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
WrapLogExit("CMenuSiteWrap::QueryStatus() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%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);
|
||||
if (pguidCmdGroup) WrapLogMsg("*pguidCmdGroup=%s\n", Wrap(*pguidCmdGroup));
|
||||
HRESULT hr = m_IOleCommandTarget->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
|
||||
WrapLogExit("CMenuSiteWrap::Exec() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObject methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::UIActivateIO(BOOL fActivate=%d, LPMSG lpMsg=%p)\n", this, fActivate, lpMsg);
|
||||
HRESULT hr = m_IInputObject->UIActivateIO(fActivate, lpMsg);
|
||||
WrapLogExit("CMenuSiteWrap::UIActivateIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::HasFocusIO()
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::HasFocusIO()\n", this);
|
||||
HRESULT hr = m_IInputObject->HasFocusIO();
|
||||
WrapLogExit("CMenuSiteWrap::HasFocusIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::TranslateAcceleratorIO(LPMSG lpMsg=%p)\n", this, lpMsg);
|
||||
if (lpMsg) WrapLogMsg("*lpMsg=%s\n", Wrap(*lpMsg));
|
||||
HRESULT hr = m_IInputObject->TranslateAcceleratorIO(lpMsg);
|
||||
WrapLogExit("CMenuSiteWrap::TranslateAcceleratorIO() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IInputObjectSite methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::OnFocusChangeIS(LPUNKNOWN lpUnknown=%p, BOOL bFocus=%d)\n", this, lpUnknown, bFocus);
|
||||
HRESULT hr = m_IInputObjectSite->OnFocusChangeIS(lpUnknown, bFocus);
|
||||
WrapLogExit("CMenuSiteWrap::OnFocusChangeIS() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IWinEventHandler methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
|
||||
{
|
||||
//WrapLogEnter("CMenuSiteWrap<%p>::OnWinEvent(HWND hWnd=%p, UINT uMsg=%u, WPARAM wParam=%08x, LPARAM lParam=%08x, LRESULT *theResult=%p)\n", this, hWnd, uMsg, wParam, lParam, theResult);
|
||||
HRESULT hr = m_IWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
|
||||
//WrapLogExit("CMenuSiteWrap::OnWinEvent() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::IsWindowOwner(HWND hWnd)
|
||||
{
|
||||
//WrapLogEnter("CMenuSiteWrap<%p>::IsWindowOwner(HWND hWnd=%08x)\n", this, hWnd);
|
||||
HRESULT hr = m_IWinEventHandler->IsWindowOwner(hWnd);
|
||||
//WrapLogExit("CMenuSiteWrap::IsWindowOwner() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// *** IServiceProvider methods ***
|
||||
HRESULT STDMETHODCALLTYPE CMenuSiteWrap::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||
{
|
||||
WrapLogEnter("CMenuSiteWrap<%p>::QueryService(REFGUID guidService=%s, REFIID riid=%s, void **ppvObject=%p)\n", this, Wrap(guidService), Wrap(riid), ppvObject);
|
||||
HRESULT hr = m_IServiceProvider->QueryService(guidService, riid, ppvObject);
|
||||
if (ppvObject) WrapLogMsg("*ppvObject=%p\n", *ppvObject);
|
||||
WrapLogExit("CMenuSiteWrap::QueryService() = %08x\n", hr);
|
||||
return hr;
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
#define USE_SYSTEM_MENUDESKBAR 0
|
||||
#define USE_SYSTEM_MENUDESKBAR 1
|
||||
#define USE_SYSTEM_MENUSITE 0
|
||||
#define USE_SYSTEM_MENUBAND 0
|
||||
|
||||
// if not using system above
|
||||
#define WRAP_MENUDESKBAR 0
|
||||
#define WRAP_MENUBAND 0
|
||||
#define WRAP_MENUDESKBAR 1
|
||||
#define WRAP_MENUSITE 1
|
||||
#define WRAP_MENUBAND 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
@ -38,8 +38,9 @@
|
|||
#define SMC_EXEC 4
|
||||
extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
|
||||
|
||||
extern "C" HRESULT CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuSite_Constructor(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuBand_Constructor(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuBand_Wrapper(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuDeskBar_Wrapper(REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuDeskBar_Wrapper(IDeskBar * db, REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuSite_Wrapper(IBandSite * bs, REFIID riid, LPVOID *ppv);
|
||||
extern "C" HRESULT CMenuBand_Wrapper(IShellMenu * sm, REFIID riid, LPVOID *ppv);
|
||||
|
|
|
@ -77,41 +77,51 @@ LPSTR Wrap(const T& value);
|
|||
template <>
|
||||
LPSTR Wrap<GUID>(REFGUID guid)
|
||||
{
|
||||
LPSTR cGuid = strTemp[nTemps++];
|
||||
StringCchPrintfA(cGuid, _countof(strTemp[0]),
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
|
||||
guid.Data1, guid.Data2, guid.Data3,
|
||||
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
||||
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
return cGuid;
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<RECT>(const RECT& rect)
|
||||
{
|
||||
LPSTR cGuid = strTemp[nTemps++];
|
||||
StringCchPrintfA(cGuid, _countof(strTemp[0]),
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{L: %d, T: %d, R: %d, B: %d}",
|
||||
rect.left, rect.top, rect.right, rect.bottom);
|
||||
return cGuid;
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<OLECMD>(const OLECMD& cmd)
|
||||
{
|
||||
LPSTR cGuid = strTemp[nTemps++];
|
||||
StringCchPrintfA(cGuid, _countof(strTemp[0]),
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{ID: %d, F: %d}",
|
||||
cmd.cmdID, cmd.cmdf);
|
||||
return cGuid;
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<MSG>(const MSG& msg)
|
||||
{
|
||||
LPSTR cGuid = strTemp[nTemps++];
|
||||
StringCchPrintfA(cGuid, _countof(strTemp[0]),
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{HWND: %d, Code: %d, W: %p, L: %p, T: %d, P.X: %d, P.Y: %d}",
|
||||
msg.hwnd, msg.message, msg.wParam, msg.lParam, msg.time, msg.pt.x, msg.pt.y);
|
||||
return cGuid;
|
||||
return cStr;
|
||||
}
|
||||
|
||||
template <>
|
||||
LPSTR Wrap<BANDSITEINFO>(const BANDSITEINFO& bsi)
|
||||
{
|
||||
LPSTR cStr = strTemp[nTemps++];
|
||||
StringCchPrintfA(cStr, _countof(strTemp[0]),
|
||||
"{dwMask: %08x, dwState: %08x, dwStyle: %08x}",
|
||||
bsi.dwMask, bsi.dwState, bsi.dwStyle);
|
||||
return cStr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue