ReactOS 0.4.15-dev-7942-gd23573b
shellbrowserimpl.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2003 Martin Fuchs
3 *
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.
8 *
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.
13 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // shellbrowserimpl.cpp
24 //
25 // Martin Fuchs, 28.09.2003
26 //
27 // Credits: Thanks to Leon Finker for his explorer cabinet window example
28 //
29
30
31#include <precomp.h>
32
33
35{
36 if (!ppvObject)
37 return E_POINTER;
38
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);
49 else {
50 *ppvObject = NULL;
51 return E_NOINTERFACE;
52 }
53
54 return S_OK;
55}
56
58{
59 if (!ppvObject)
60 return E_POINTER;
61
63
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);
76 else {
77 *ppvObject = NULL;
78 return E_NOINTERFACE;
79 }
80
81 return S_OK;
82}
83
84HRESULT IShellBrowserImpl::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText)
85{
86 return E_FAIL;
87}
88
89HRESULT IShellBrowserImpl::Exec(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut)
90{
91 return E_FAIL;
92}
93
94
95 // process default command: look for folders and traverse into them
97{
99
100 HRESULT hr = ppshv->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (void**)&selection);
101 if (FAILED(hr))
102 return hr;
103
104 PIDList pidList;
105
106 hr = pidList.GetData(selection);
107 if (FAILED(hr)) {
108 selection->Release();
109 return hr;
110 }
111
112 hr = OnDefaultCommand(pidList);
113
114 selection->Release();
115
116 return hr;
117}
const GUID IID_IUnknown
int selection
Definition: ctm.c:92
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
HRESULT GetItemObject([in] UINT uItem, [in] REFIID riid, [out, iid_is(riid)] void **ppv)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const GUID IID_IOleWindow
const GUID IID_IDataObject
#define REFIID
Definition: guiddef.h:118
HRESULT hr
Definition: shlfolder.c:183
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand(IShellView *ppshv)
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
list of PIDLs
HRESULT GetData(IDataObject *selection)
Definition: scsiwmi.h:51
uint32_t ULONG
Definition: typedefs.h:59
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365