implement IServiceprovider interface

svn path=/trunk/; revision=10334
This commit is contained in:
Martin Fuchs
2004-08-01 09:26:27 +00:00
parent 06b9a76a1b
commit 79e842231c
2 changed files with 56 additions and 1 deletions
@@ -44,6 +44,8 @@ HRESULT IShellBrowserImpl::QueryInterface(REFIID iid, void** ppvObject)
*ppvObject = static_cast<IShellBrowser*>(this);
else if (iid == IID_ICommDlgBrowser)
*ppvObject = static_cast<ICommDlgBrowser*>(this);
else if (iid == IID_IServiceProvider)
*ppvObject = static_cast<IServiceProvider*>(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<IShellBrowser*>(this);
else if (riid == IID_IOleWindow)
*ppvObject = static_cast<IOleWindow*>(this);
else if (riid == IID_IShellBrowser)
*ppvObject = static_cast<IShellBrowser*>(this);
else if (riid == IID_ICommDlgBrowser)
*ppvObject = static_cast<ICommDlgBrowser*>(this);
else if (riid == IID_IServiceProvider)
*ppvObject = static_cast<IServiceProvider*>(this);
else if (riid == IID_IOleCommandTarget)
*ppvObject = static_cast<IOleCommandTarget*>(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)
@@ -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;