ReactOS 0.4.15-dev-8119-g4fb2fdb
internettoolbar.cpp File Reference
#include "precomp.h"
Include dependency graph for internettoolbar.cpp:

Go to the source code of this file.

Classes

class  CDockSite
 

Functions

STDMETHOD() GetNameSpaceID (LPCITEMIDLIST, LPGUID) PURE
 
STDMETHOD() QueryNameSpace (ULONG, LPGUID, IShellFolder **) PURE
 
STDMETHOD() EnumNameSpace (ULONG, PULONG) PURE
 
HRESULT WINAPI SHBindToFolder (LPCITEMIDLIST path, IShellFolder **newFolder)
 
HRESULT IUnknown_RelayWinEvent (IUnknown *punk, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
 
HRESULT IUnknown_ShowDW (IUnknown *punk, BOOL fShow)
 
HRESULT IUnknown_CloseDW (IUnknown *punk, DWORD dwReserved)
 
static HRESULT BindToDesktop (LPCITEMIDLIST pidl, IShellFolder **ppsfResult)
 
static HRESULT GetFavoritesFolder (IShellFolder **ppsfFavorites, LPITEMIDLIST *ppidl)
 

Variables

interface IShellFolder LPCITEMIDLIST
 
interface IShellFolder ULONG PURE
 

Function Documentation

◆ BindToDesktop()

static HRESULT BindToDesktop ( LPCITEMIDLIST  pidl,
IShellFolder **  ppsfResult 
)
static

Definition at line 372 of file internettoolbar.cpp.

373{
374 HRESULT hr;
375 CComPtr<IShellFolder> psfDesktop;
376
377 *ppsfResult = NULL;
378
379 hr = SHGetDesktopFolder(&psfDesktop);
380 if (FAILED(hr))
381 return hr;
382
383 hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, ppsfResult));
384
385 return hr;
386}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define NULL
Definition: types.h:112
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

Referenced by GetFavoritesFolder().

◆ EnumNameSpace()

STDMETHOD() EnumNameSpace ( ULONG  ,
PULONG   
)

◆ GetFavoritesFolder()

static HRESULT GetFavoritesFolder ( IShellFolder **  ppsfFavorites,
LPITEMIDLIST ppidl 
)
static

Definition at line 388 of file internettoolbar.cpp.

389{
390 HRESULT hr;
391 LPITEMIDLIST pidlUserFavorites;
392 LPITEMIDLIST pidlCommonFavorites;
393 CComPtr<IShellFolder> psfUserFavorites;
394 CComPtr<IShellFolder> psfCommonFavorites;
396
397 if (ppsfFavorites)
398 *ppsfFavorites = NULL;
399
400 if (ppidl)
401 *ppidl = NULL;
402
403 hr = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidlUserFavorites);
404 if (FAILED(hr))
405 {
406 WARN("Failed to get the USER favorites folder. Trying to run with just the COMMON one.\n");
407
410 return hr;
411
412 TRACE("COMMON favorites obtained.\n");
413 *ppidl = pidlCommonFavorites;
414 hr = BindToDesktop(pidlCommonFavorites, ppsfFavorites);
415 return hr;
416 }
417
420 {
421 WARN("Failed to get the COMMON favorites folder. Will use only the USER contents.\n");
422 *ppidl = pidlCommonFavorites;
423 hr = BindToDesktop(pidlUserFavorites, ppsfFavorites);
424 return hr;
425 }
426
427 TRACE("Both COMMON and USER favorites folders obtained, merging them...\n");
428
429 hr = BindToDesktop(pidlUserFavorites, &psfUserFavorites);
431 return hr;
432
433 hr = BindToDesktop(pidlCommonFavorites, &psfCommonFavorites);
435 return hr;
436
437 hr = CMergedFolder_CreateInstance(IID_PPV_ARG(IAugmentedShellFolder, &pasf));
439 {
440 *ppsfFavorites = psfUserFavorites.Detach();
441 *ppidl = pidlUserFavorites;
442 ILFree(pidlCommonFavorites);
443 return hr;
444 }
445
446 hr = pasf->AddNameSpace(NULL, psfUserFavorites, pidlUserFavorites, 0xFF00);
448 return hr;
449
450 hr = pasf->AddNameSpace(NULL, psfCommonFavorites, pidlCommonFavorites, 0);
452 return hr;
453
454 hr = pasf->QueryInterface(IID_PPV_ARG(IShellFolder, ppsfFavorites));
455 pasf.Release();
456
457 // TODO: obtain the folder's PIDL
458
459 ILFree(pidlCommonFavorites);
460 ILFree(pidlUserFavorites);
461
462 return hr;
463}
#define WARN(fmt,...)
Definition: debug.h:115
void Release()
Definition: atlcomcli.h:170
T * Detach()
Definition: atlcomcli.h:186
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3260
static HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder **ppsfResult)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
#define CMergedFolder_CreateInstance
Definition: shellmenu.h:93
#define CSIDL_FAVORITES
Definition: shlobj.h:2165
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2189
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CMenuCallback::GetObject().

◆ GetNameSpaceID()

STDMETHOD() GetNameSpaceID ( LPCITEMIDLIST  ,
LPGUID   
)

◆ IUnknown_CloseDW()

HRESULT IUnknown_CloseDW ( IUnknown punk,
DWORD  dwReserved 
)

Definition at line 104 of file internettoolbar.cpp.

105{
106 CComPtr<IDockingWindow> dockingWindow;
107 HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
108 if (FAILED_UNEXPECTEDLY(hResult))
109 return hResult;
110 hResult = dockingWindow->CloseDW(dwReserved);
111 if (FAILED_UNEXPECTEDLY(hResult))
112 return hResult;
113 return S_OK;
114}
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

Referenced by CInternetToolbar::CloseDW().

◆ IUnknown_RelayWinEvent()

HRESULT IUnknown_RelayWinEvent ( IUnknown punk,
HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult 
)

Definition at line 78 of file internettoolbar.cpp.

79{
80 CComPtr<IWinEventHandler> menuWinEventHandler;
81 HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
82 if (FAILED_UNEXPECTEDLY(hResult))
83 return hResult;
84 hResult = menuWinEventHandler->IsWindowOwner(hWnd);
85 if (FAILED_UNEXPECTEDLY(hResult))
86 return hResult;
87 if (hResult == S_OK)
88 return menuWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
89 return S_FALSE;
90}
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define S_FALSE
Definition: winerror.h:2357

Referenced by CInternetToolbar::OnWinEvent().

◆ IUnknown_ShowDW()

HRESULT IUnknown_ShowDW ( IUnknown punk,
BOOL  fShow 
)

Definition at line 92 of file internettoolbar.cpp.

93{
94 CComPtr<IDockingWindow> dockingWindow;
95 HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
96 if (FAILED_UNEXPECTEDLY(hResult))
97 return hResult;
98 hResult = dockingWindow->ShowDW(fShow);
99 if (FAILED_UNEXPECTEDLY(hResult))
100 return hResult;
101 return S_OK;
102}

Referenced by CShellBrowser::Exec(), CShellBrowser::Initialize(), and CInternetToolbar::ShowDW().

◆ QueryNameSpace()

STDMETHOD() QueryNameSpace ( ULONG  ,
LPGUID  ,
IShellFolder **   
)

◆ SHBindToFolder()

HRESULT WINAPI SHBindToFolder ( LPCITEMIDLIST  path,
IShellFolder **  newFolder 
)

Definition at line 153 of file shellbrowser.cpp.

154{
155 CComPtr<IShellFolder> desktop;
156
157 HRESULT hr = ::SHGetDesktopFolder(&desktop);
159 return E_FAIL;
160 if (path == NULL || path->mkid.cb == 0)
161 {
162 *newFolder = desktop;
163 desktop.p->AddRef ();
164 return S_OK;
165 }
166 return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
167}
#define E_FAIL
Definition: ddrawi.h:102

Referenced by CShellBrowser::BrowseToPIDL().

Variable Documentation

◆ LPCITEMIDLIST

◆ PURE

Definition at line 32 of file internettoolbar.cpp.