2 * Copyright 2003 Martin Fuchs
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 // shellbrowserimpl.cpp
25 // Martin Fuchs, 28.09.2003
27 // Credits: Thanks to Leon Finker for his explorer cabinet window example
34 HRESULT
IShellBrowserImpl::QueryInterface(REFIID iid
, void** ppvObject
)
39 if (iid
== IID_IUnknown
)
40 *ppvObject
= (IUnknown
*)static_cast<IShellBrowser
*>(this);
41 else if (iid
== IID_IOleWindow
)
42 *ppvObject
= static_cast<IOleWindow
*>(this);
43 else if (iid
== IID_IShellBrowser
)
44 *ppvObject
= static_cast<IShellBrowser
*>(this);
45 else if (iid
== IID_ICommDlgBrowser
)
46 *ppvObject
= static_cast<ICommDlgBrowser
*>(this);
47 else if (iid
== IID_IServiceProvider
)
48 *ppvObject
= static_cast<IServiceProvider
*>(this);
57 HRESULT
IShellBrowserImpl::QueryService(REFGUID guidService
, REFIID riid
, void** ppvObject
)
62 ///@todo use guidService
64 if (riid
== IID_IUnknown
)
65 *ppvObject
= (IUnknown
*)static_cast<IShellBrowser
*>(this);
66 else if (riid
== IID_IOleWindow
)
67 *ppvObject
= static_cast<IOleWindow
*>(this);
68 else if (riid
== IID_IShellBrowser
)
69 *ppvObject
= static_cast<IShellBrowser
*>(this);
70 else if (riid
== IID_ICommDlgBrowser
)
71 *ppvObject
= static_cast<ICommDlgBrowser
*>(this);
72 else if (riid
== IID_IServiceProvider
)
73 *ppvObject
= static_cast<IServiceProvider
*>(this);
74 else if (riid
== IID_IOleCommandTarget
)
75 *ppvObject
= static_cast<IOleCommandTarget
*>(this);
84 HRESULT
IShellBrowserImpl::QueryStatus(const GUID
* pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
* pCmdText
)
86 return E_FAIL
; ///@todo implement IOleCommandTarget
89 HRESULT
IShellBrowserImpl::Exec(const GUID
* pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
* pvaIn
, VARIANT
* pvaOut
)
91 return E_FAIL
; ///@todo implement IOleCommandTarget
95 // process default command: look for folders and traverse into them
96 HRESULT
IShellBrowserImpl::OnDefaultCommand(IShellView
* ppshv
)
98 IDataObject
* selection
;
100 HRESULT hr
= ppshv
->GetItemObject(SVGIO_SELECTION
, IID_IDataObject
, (void**)&selection
);
106 hr
= pidList
.GetData(selection
);
108 selection
->Release();
112 hr
= OnDefaultCommand(pidList
);
114 selection
->Release();