From 79e842231cc307203cb5b8e662f4e4b72d355a8f Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 1 Aug 2004 09:26:27 +0000 Subject: [PATCH] implement IServiceprovider interface svn path=/trunk/; revision=10334 --- .../explorer/utility/shellbrowserimpl.cpp | 39 +++++++++++++++++++ .../explorer/utility/shellbrowserimpl.h | 18 ++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp b/reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp index ae523f1f5bd..6e7c4eccd65 100644 --- a/reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp +++ b/reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp @@ -44,6 +44,8 @@ HRESULT IShellBrowserImpl::QueryInterface(REFIID iid, void** ppvObject) *ppvObject = static_cast(this); else if (iid == IID_ICommDlgBrowser) *ppvObject = static_cast(this); + else if (iid == IID_IServiceProvider) + *ppvObject = static_cast(this); else { *ppvObject = NULL; return E_NOINTERFACE; @@ -52,6 +54,43 @@ HRESULT IShellBrowserImpl::QueryInterface(REFIID iid, void** ppvObject) return S_OK; } +HRESULT STDMETHODCALLTYPE IShellBrowserImpl::QueryService(REFGUID guidService, REFIID riid, void** ppvObject) +{ + if (!ppvObject) + return E_POINTER; + + ///@todo use guidService + + if (riid == IID_IUnknown) + *ppvObject = (IUnknown*)static_cast(this); + else if (riid == IID_IOleWindow) + *ppvObject = static_cast(this); + else if (riid == IID_IShellBrowser) + *ppvObject = static_cast(this); + else if (riid == IID_ICommDlgBrowser) + *ppvObject = static_cast(this); + else if (riid == IID_IServiceProvider) + *ppvObject = static_cast(this); + else if (riid == IID_IOleCommandTarget) + *ppvObject = static_cast(this); + else { + *ppvObject = NULL; + return E_NOINTERFACE; + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE IShellBrowserImpl::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText) +{ + return E_FAIL; ///@todo implement IOleCommandTarget +} + +HRESULT STDMETHODCALLTYPE IShellBrowserImpl::Exec(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut) +{ + return E_FAIL; ///@todo implement IOleCommandTarget +} + // process default command: look for folders and traverse into them HRESULT IShellBrowserImpl::OnDefaultCommand(IShellView* ppshv) diff --git a/reactos/subsys/system/explorer/utility/shellbrowserimpl.h b/reactos/subsys/system/explorer/utility/shellbrowserimpl.h index 933a001c534..e4a63852e00 100644 --- a/reactos/subsys/system/explorer/utility/shellbrowserimpl.h +++ b/reactos/subsys/system/explorer/utility/shellbrowserimpl.h @@ -27,9 +27,18 @@ // Credits: Thanks to Leon Finker for his explorer cabinet window example // +#ifdef __MINGW32__ +#include "servprov.h" // for IServiceProvider +#include "docobj.h" // for IOleCommandTarget +#endif + /// Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellBrowserChild) -struct IShellBrowserImpl : public IShellBrowser, public ICommDlgBrowser +struct IShellBrowserImpl + : public IShellBrowser, + public ICommDlgBrowser, + public IServiceProvider, + public IOleCommandTarget { IShellBrowserImpl() : _dwRef(0) @@ -69,6 +78,13 @@ struct IShellBrowserImpl : public IShellBrowser, public ICommDlgBrowser virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) {return E_NOTIMPL;} virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(LPMSG lpmsg, WORD wID) {return S_OK;} + // IServiceProvider + virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void** ppvObject); + + // 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); + protected: DWORD _dwRef;