ReactOS  0.4.15-dev-1386-g5cb9f87
CTravelEntry Class Reference
Inheritance diagram for CTravelEntry:
Collaboration diagram for CTravelEntry:

Public Member Functions

 CTravelEntry ()
 
 ~CTravelEntry ()
 
HRESULT GetToolTipText (IUnknown *punk, LPWSTR pwzText) const
 
long GetSize () const
 
virtual HRESULT STDMETHODCALLTYPE Invoke (IUnknown *punk)
 
virtual HRESULT STDMETHODCALLTYPE Update (IUnknown *punk, BOOL fIsLocalAnchor)
 
virtual HRESULT STDMETHODCALLTYPE GetPidl (LPITEMIDLIST *ppidl)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from ITravelEntry
HRESULT GetPidl ([out] PIDLIST_ABSOLUTE *ppidl)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Public Attributes

CTravelEntryfNextEntry
 
CTravelEntryfPreviousEntry
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Private Attributes

LPITEMIDLIST fPIDL
 
HGLOBAL fPersistState
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 

Detailed Description

Definition at line 46 of file travellog.cpp.

Constructor & Destructor Documentation

◆ CTravelEntry()

CTravelEntry::CTravelEntry ( )

Definition at line 110 of file travellog.cpp.

111 {
112  fNextEntry = NULL;
114  fPIDL = NULL;
116 }
HGLOBAL fPersistState
Definition: travellog.cpp:55
CTravelEntry * fNextEntry
Definition: travellog.cpp:51
CTravelEntry * fPreviousEntry
Definition: travellog.cpp:52
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54
#define NULL
Definition: types.h:112

◆ ~CTravelEntry()

CTravelEntry::~CTravelEntry ( )

Definition at line 118 of file travellog.cpp.

119 {
120  ILFree(fPIDL);
122 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HGLOBAL fPersistState
Definition: travellog.cpp:55
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54

Member Function Documentation

◆ GetPidl()

HRESULT STDMETHODCALLTYPE CTravelEntry::GetPidl ( LPITEMIDLIST ppidl)
virtual

Definition at line 207 of file travellog.cpp.

208 {
209  if (ppidl == NULL)
210  return E_POINTER;
211  *ppidl = ILClone(fPIDL);
212  if (*ppidl == NULL)
213  return E_OUTOFMEMORY;
214 
215  TRACE("CTravelEntry::GetPidl returning ppidl=%p\n", *ppidl);
216 
217  return S_OK;
218 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
#define E_POINTER
Definition: winerror.h:2365

◆ GetSize()

long CTravelEntry::GetSize ( void  ) const

Definition at line 135 of file travellog.cpp.

136 {
137  return 0;
138 }

Referenced by CTravelLog::DeleteChain().

◆ GetToolTipText()

HRESULT CTravelEntry::GetToolTipText ( IUnknown punk,
LPWSTR  pwzText 
) const

Definition at line 124 of file travellog.cpp.

125 {
126  HRESULT hResult;
127 
128  hResult = ILGetDisplayNameEx(NULL, fPIDL, pwzText, ILGDN_NORMAL) ? S_OK : E_FAIL;
129  if (FAILED_UNEXPECTEDLY(hResult))
130  return hResult;
131 
132  return S_OK;
133 }
#define E_FAIL
Definition: ddrawi.h:102
#define ILGDN_NORMAL
Definition: undocshell.h:69
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54
BOOL WINAPI ILGetDisplayNameEx(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type)
Definition: pidl.c:162
#define NULL
Definition: types.h:112

Referenced by CTravelLog::GetToolTipText(), CTravelLog::InsertMenuEntries(), and Update().

◆ Invoke()

HRESULT STDMETHODCALLTYPE CTravelEntry::Invoke ( IUnknown punk)
virtual

Implements ITravelEntry.

Definition at line 140 of file travellog.cpp.

141 {
142  CComPtr<IPersistHistory> persistHistory;
143  CComPtr<IStream> globalStream;
144  HRESULT hResult;
145 
146  TRACE("CTravelEntry::Invoke for IUnknown punk=%p\n", punk);
147 
148  hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
149  if (FAILED_UNEXPECTEDLY(hResult))
150  return hResult;
151  hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream);
152  if (FAILED_UNEXPECTEDLY(hResult))
153  return hResult;
154  hResult = persistHistory->LoadHistory(globalStream, NULL);
155  if (FAILED_UNEXPECTEDLY(hResult))
156  return hResult;
157  return S_OK;
158 }
HGLOBAL fPersistState
Definition: travellog.cpp:55
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define IID_PPV_ARG(Itype, ppType)
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by CTravelLog::Travel().

◆ Update()

HRESULT STDMETHODCALLTYPE CTravelEntry::Update ( IUnknown punk,
BOOL  fIsLocalAnchor 
)
virtual

Implements ITravelEntry.

Definition at line 160 of file travellog.cpp.

161 {
162  CComPtr<ITravelLogClient> travelLogClient;
163  CComPtr<IPersistHistory> persistHistory;
164  CComPtr<IStream> globalStream;
165  WINDOWDATA windowData;
166  HRESULT hResult;
167 
168  TRACE("CTravelEntry::Update for IUnknown punk=%p, fIsLocalAnchor=%s\n", punk, fIsLocalAnchor ? "TRUE" : "FALSE");
169 
170 
171  WCHAR wch[MAX_PATH * 2];
172  GetToolTipText(punk, wch);
173  TRACE("Updating entry with display name: %S\n", wch);
174 
175  ZeroMemory(&windowData, sizeof(WINDOWDATA));
176  ILFree(fPIDL);
177  fPIDL = NULL;
180  hResult = punk->QueryInterface(IID_PPV_ARG(ITravelLogClient, &travelLogClient));
181  if (FAILED_UNEXPECTEDLY(hResult))
182  return hResult;
183  hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
184  if (FAILED_UNEXPECTEDLY(hResult))
185  return hResult;
186  hResult = CreateStreamOnHGlobal(NULL, FALSE, &globalStream);
187  if (FAILED_UNEXPECTEDLY(hResult))
188  return hResult;
189  hResult = persistHistory->SaveHistory(globalStream);
190  if (FAILED_UNEXPECTEDLY(hResult))
191  return hResult;
192  hResult = travelLogClient->GetWindowData(globalStream, &windowData);
193  if (FAILED_UNEXPECTEDLY(hResult))
194  return hResult;
195  fPIDL = windowData.pidl;
196  // TODO: Properly free the windowData
197  hResult = GetHGlobalFromStream(globalStream, &fPersistState);
198  if (FAILED_UNEXPECTEDLY(hResult))
199  return hResult;
200 
201  GetToolTipText(punk, wch);
202  TRACE("Updated entry display name is now: %S\n", wch);
203 
204  return S_OK;
205 }
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HGLOBAL fPersistState
Definition: travellog.cpp:55
#define ZeroMemory
Definition: winbase.h:1648
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define IID_PPV_ARG(Itype, ppType)
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:34
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
PIDLIST_ABSOLUTE pidl
Definition: tlogstg.idl:26
HRESULT GetToolTipText(IUnknown *punk, LPWSTR pwzText) const
Definition: travellog.cpp:124
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST fPIDL
Definition: travellog.cpp:54
#define NULL
Definition: types.h:112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by CTravelLog::UpdateEntry().

Member Data Documentation

◆ fNextEntry

◆ fPersistState

HGLOBAL CTravelEntry::fPersistState
private

Definition at line 55 of file travellog.cpp.

Referenced by CTravelEntry(), Invoke(), Update(), and ~CTravelEntry().

◆ fPIDL

LPITEMIDLIST CTravelEntry::fPIDL
private

Definition at line 54 of file travellog.cpp.

Referenced by CTravelEntry(), GetPidl(), GetToolTipText(), Update(), and ~CTravelEntry().

◆ fPreviousEntry


The documentation for this class was generated from the following file: