ReactOS 0.4.15-dev-8227-g32d615f
CMenuCallback Class Reference

#include <internettoolbar.h>

Inheritance diagram for CMenuCallback:
Collaboration diagram for CMenuCallback:

Public Member Functions

 CMenuCallback ()
 
virtual ~CMenuCallback ()
 
HRESULT STDMETHODCALLTYPE GetObject (LPSMDATA psmd, REFIID riid, void **ppvObject)
 
virtual HRESULT STDMETHODCALLTYPE CallbackSM (LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 CMenuCallback (struct _test_info *testResults, int testsCount)
 
void SetTest (int i)
 
HRESULT STDMETHODCALLTYPE CallbackSM (LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- 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 ()
 
HRESULT CallbackSM ([in, out] LPSMDATA psmd, [in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from CUnknownBase< IShellMenuCallback >
 CUnknownBase (bool autoDelete=true, LONG initialRef=0)
 
ULONG STDMETHODCALLTYPE AddRef ()
 
ULONG STDMETHODCALLTYPE Release ()
 
HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void **ppv)
 
virtual ~CUnknownBase ()
 
LONG GetRef () const
 

Protected Member Functions

const QITABGetQITab ()
 
virtual const QITABGetQITab ()=0
 

Protected Attributes

int m_iTest
 
int m_iCallback
 
struct _test_infom_results
 
int m_testsCount
 

Private Attributes

CComPtr< IShellMenufFavoritesMenu
 

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)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 40 of file internettoolbar.h.

Constructor & Destructor Documentation

◆ CMenuCallback() [1/2]

CMenuCallback::CMenuCallback ( )

Definition at line 364 of file internettoolbar.cpp.

365{
366}

◆ ~CMenuCallback()

CMenuCallback::~CMenuCallback ( )
virtual

Definition at line 368 of file internettoolbar.cpp.

369{
370}

◆ CMenuCallback() [2/2]

CMenuCallback::CMenuCallback ( struct _test_info testResults,
int  testsCount 
)
inline

Definition at line 230 of file menu.cpp.

231 :CUnknownBase( true, 0 )
232 {
233 m_iTest = 0;
234 m_iCallback = 0;
235 m_results = testResults;
236 m_testsCount = testsCount;
237 }
int m_testsCount
Definition: menu.cpp:221
int m_iCallback
Definition: menu.cpp:219
int m_iTest
Definition: menu.cpp:218
struct _test_info * m_results
Definition: menu.cpp:220

Member Function Documentation

◆ CallbackSM() [1/2]

HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM ( LPSMDATA  psmd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Implements IShellMenuCallback.

Definition at line 529 of file internettoolbar.cpp.

530{
531 switch (uMsg)
532 {
533 case SMC_INITMENU:
534 break;
535 case SMC_CREATE:
536 break;
537 case SMC_EXITMENU:
538 break;
539 case SMC_GETINFO:
540 {
541 SMINFO *infoPtr = reinterpret_cast<SMINFO *>(lParam);
542 if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
543 {
544 if (psmd->uId == FCIDM_MENU_FAVORITES)
545 {
546 infoPtr->dwFlags |= SMIF_DROPCASCADE;
547 }
548 else
549 {
550 infoPtr->dwFlags |= SMIF_TRACKPOPUP;
551 }
552 }
553 if ((infoPtr->dwMask & SMIM_ICON) != 0)
554 infoPtr->iIcon = -1;
555 return S_OK;
556 }
557 case SMC_GETSFINFO:
558 break;
559 case SMC_GETOBJECT:
560 return GetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
561 case SMC_GETSFOBJECT:
562 break;
563 case SMC_EXEC:
564 PostMessageW(psmd->hwnd, WM_COMMAND, psmd->uId, 0);
565 break;
566 case SMC_SFEXEC:
567 SHInvokeDefaultCommand(psmd->hwnd, psmd->psf, psmd->pidlItem);
568 break;
569 case SMC_SFSELECTITEM:
570 break;
571 case 13:
572 // return tooltip
573 break;
574 case SMC_REFRESH:
575 break;
576 case SMC_DEMOTE:
577 break;
578 case SMC_PROMOTE:
579 break;
580 case 0x13:
581 break;
582 case SMC_DEFAULTICON:
583 break;
584 case SMC_NEWITEM:
585 break;
586 case SMC_CHEVRONEXPAND:
587 break;
588 case SMC_DISPLAYCHEVRONTIP:
589 break;
590 case SMC_SETSFOBJECT:
591 break;
592 case SMC_SHCHANGENOTIFY:
593 break;
594 case SMC_CHEVRONGETTIP:
595 break;
596 case SMC_SFDDRESTRICTED:
597 break;
598 case 0x35:
599 break;
600 case 49:
601 break;
602 case 0x10000000:
603 break;
604 }
605 return S_FALSE;
606}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder *lpFolder, LPCITEMIDLIST lpApidl)
Definition: ordinal.c:3056
#define S_OK
Definition: intsafe.h:52
#define FCIDM_MENU_FAVORITES
Definition: shlobj.h:639
@ SMIM_ICON
Definition: shobjidl.idl:2740
@ SMIM_FLAGS
Definition: shobjidl.idl:2739
@ SMIF_DROPCASCADE
Definition: shobjidl.idl:2756
@ SMIF_TRACKPOPUP
Definition: shobjidl.idl:2759
PUITEMID_CHILD pidlItem
Definition: shobjidl.idl:2710
IShellFolder * psf
Definition: shobjidl.idl:2711
DWORD dwMask
Definition: shobjidl.idl:2721
DWORD dwFlags
Definition: shobjidl.idl:2723
#define SMC_EXEC
Definition: undocshell.h:724
#define S_FALSE
Definition: winerror.h:2357
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1740

◆ CallbackSM() [2/2]

HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM ( LPSMDATA  psmd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inline

Implements IShellMenuCallback.

Definition at line 244 of file menu.cpp.

245 {
246 /*trace ("callback type %d\n", uMsg);*/
247
248 /*
249 * it seems callback 0x10000000 is called for every item added so
250 * we will ignore consecutive callbacks of this type
251 * Note: this callback is invoked by shell32.dll!CMenuSFToolbar::_FilterPidl
252 */
253 if (uMsg == 0x10000000 && m_results[m_iCallback-1].uMsg == 0x10000000)
254 {
255 return S_OK;
256 }
257
258 m_iCallback++;
260 {
261 ok(0, "Got more callbacks than expected! (%d not %d). uMsg: %d\n", m_iCallback, m_testsCount, uMsg);
262 return S_OK;
263 }
264
266
267 ok(psmd != NULL, "Got NULL psmd\n");
268 ok(m_iTest == result->iTest, "Wrong test number (%d not %d)\n", m_iTest, result->iTest);
269 ok(result->uMsg == uMsg, "%d: Got wrong uMsg (%d instead of %d)\n", m_iCallback, uMsg, result->uMsg);
270
271 if(uMsg == SMC_CREATE)
272 {
273 ok(psmd->dwFlags == 0, "wrong dwFlags\n");
274 ok(psmd->dwMask == 0, "wrong dwMask\n");
275 ok(psmd->hmenu == 0, "wrong hmenu\n");
276 ok(psmd->hwnd == 0, "wrong hwnd\n");
277 ok(psmd->punk != NULL, "punk is null\n");
278 }
279
280 if (uMsg == SMC_GETSFOBJECT)
281 {
282 ok(psmd->psf != 0, "wrong dwFlags\n");
283 }
284
285 return S_FALSE;
286 }
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
GLuint64EXT * result
Definition: glext.h:11304
DWORD dwMask
Definition: shobjidl.idl:2701
IUnknown * punk
Definition: shobjidl.idl:2708
HMENU hmenu
Definition: shobjidl.idl:2703
DWORD dwFlags
Definition: shobjidl.idl:2702

◆ GetObject()

HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject ( LPSMDATA  psmd,
REFIID  riid,
void **  ppvObject 
)

Definition at line 465 of file internettoolbar.cpp.

466{
467 CComPtr<IShellMenu> parentMenu;
468 CComPtr<IShellMenu> newMenu;
469 CComPtr<IShellFolder> favoritesFolder;
470 LPITEMIDLIST favoritesPIDL;
471 HWND ownerWindow;
472 HMENU parentHMenu;
473 HMENU favoritesHMenu;
474 HKEY orderRegKey;
475 DWORD disposition;
476 HRESULT hResult;
477 static const TCHAR szFavoritesKey[] =
478 _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites");
479
480 if (!IsEqualIID(riid, IID_IShellMenu))
481 return E_FAIL;
482 if (psmd->uId != FCIDM_MENU_FAVORITES)
483 return E_FAIL;
484
485 // create favorites menu
486 hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
487 if (FAILED_UNEXPECTEDLY(hResult))
488 return hResult;
489 hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
490 if (FAILED_UNEXPECTEDLY(hResult))
491 return hResult;
492 favoritesHMenu = GetSubMenu(parentHMenu, 3);
493 if (favoritesHMenu == NULL)
494 return E_FAIL;
495
496 if (fFavoritesMenu.p == NULL)
497 {
498 hResult = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &newMenu));
499 if (FAILED_UNEXPECTEDLY(hResult))
500 return hResult;
501 hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
502 if (FAILED_UNEXPECTEDLY(hResult))
503 return hResult;
504
505 RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
506 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
507
508 hResult = GetFavoritesFolder(&favoritesFolder, &favoritesPIDL);
509 if (FAILED_UNEXPECTEDLY(hResult))
510 return hResult;
511
512 hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
513 if (favoritesPIDL)
514 ILFree(favoritesPIDL);
515
516 if (FAILED(hResult))
517 return hResult;
518
519 fFavoritesMenu = newMenu;
520 }
521
522 hResult = fFavoritesMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
523 if (FAILED_UNEXPECTEDLY(hResult))
524 return hResult;
525
526 return fFavoritesMenu->QueryInterface(riid, ppvObject);
527}
CComPtr< IShellMenu > fFavoritesMenu
#define E_FAIL
Definition: ddrawi.h:102
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
static HRESULT GetFavoritesFolder(IShellFolder **ppsfFavorites, LPITEMIDLIST *ppidl)
#define FAILED(hr)
Definition: intsafe.h:51
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define CMenuBand_CreateInstance
Definition: shellmenu.h:81
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define _T(x)
Definition: vfdio.h:22
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegCreateKeyEx
Definition: winreg.h:501
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define IID_PPV_ARG(Itype, ppType)
char TCHAR
Definition: xmlstorage.h:189

◆ GetQITab()

const QITAB * CMenuCallback::GetQITab ( )
inlineprotectedvirtual

Implements CUnknownBase< IShellMenuCallback >.

Definition at line 223 of file menu.cpp.

224 {
225 static const QITAB tab[] = {{ &IID_IShellMenuCallback, OFFSETOFCLASS(IShellMenuCallback, CMenuCallback) }, {0}};
226 return tab;
227 }
#define OFFSETOFCLASS(base, derived)
Definition: shlwapi.h:2090

◆ SetTest()

void CMenuCallback::SetTest ( int  i)
inline

Definition at line 239 of file menu.cpp.

240 {
241 m_iTest = i;
242 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Member Data Documentation

◆ fFavoritesMenu

CComPtr<IShellMenu> CMenuCallback::fFavoritesMenu
private

Definition at line 45 of file internettoolbar.h.

Referenced by GetObject().

◆ m_iCallback

int CMenuCallback::m_iCallback
protected

Definition at line 219 of file menu.cpp.

Referenced by CallbackSM(), and CMenuCallback().

◆ m_iTest

int CMenuCallback::m_iTest
protected

Definition at line 218 of file menu.cpp.

Referenced by CallbackSM(), CMenuCallback(), and SetTest().

◆ m_results

struct _test_info* CMenuCallback::m_results
protected

Definition at line 220 of file menu.cpp.

Referenced by CallbackSM(), and CMenuCallback().

◆ m_testsCount

int CMenuCallback::m_testsCount
protected

Definition at line 221 of file menu.cpp.

Referenced by CallbackSM(), and CMenuCallback().


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