ReactOS  0.4.14-dev-583-g2a1ba2c
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 
84 HRESULT IShellBrowserImpl::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText)
85 {
86  return E_FAIL;
87 }
88 
89 HRESULT 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 }
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT GetData(IDataObject *selection)
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
REFIID riid
Definition: precomp.h:44
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
const GUID IID_IDataObject
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
#define E_FAIL
Definition: ddrawi.h:102
int selection
Definition: ctm.c:92
virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand(IShellView *ppshv)
smooth NULL
Definition: ftsmooth.c:416
list of PIDLs
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
HRESULT GetItemObject([in] UINT uItem, [in] REFIID riid, [out, iid_is(riid)] void **ppv)
const GUID IID_IOleWindow
unsigned int ULONG
Definition: retypes.h:1
#define E_POINTER
Definition: winerror.h:2365