ReactOS 0.4.16-dev-91-g764881a
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 44 of file internettoolbar.h.

Constructor & Destructor Documentation

◆ CMenuCallback() [1/2]

CMenuCallback::CMenuCallback ( )

Definition at line 378 of file internettoolbar.cpp.

379{
380}

◆ ~CMenuCallback()

CMenuCallback::~CMenuCallback ( )
virtual

Definition at line 382 of file internettoolbar.cpp.

383{
384}

◆ 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 543 of file internettoolbar.cpp.

544{
545 switch (uMsg)
546 {
547 case SMC_INITMENU:
548 break;
549 case SMC_CREATE:
550 break;
551 case SMC_EXITMENU:
552 break;
553 case SMC_GETINFO:
554 {
555 SMINFO *infoPtr = reinterpret_cast<SMINFO *>(lParam);
556 if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
557 {
558 if (psmd->uId == FCIDM_MENU_FAVORITES)
559 {
560 infoPtr->dwFlags |= SMIF_DROPCASCADE;
561 }
562 else
563 {
564 infoPtr->dwFlags |= SMIF_TRACKPOPUP;
565 }
566 }
567 if ((infoPtr->dwMask & SMIM_ICON) != 0)
568 infoPtr->iIcon = -1;
569 return S_OK;
570 }
571 case SMC_GETSFINFO:
572 break;
573 case SMC_GETOBJECT:
574 return GetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
575 case SMC_GETSFOBJECT:
576 break;
577 case SMC_EXEC:
578 PostMessageW(psmd->hwnd, WM_COMMAND, psmd->uId, 0);
579 break;
580 case SMC_SFEXEC:
581 SHInvokeDefaultCommand(psmd->hwnd, psmd->psf, psmd->pidlItem);
582 break;
583 case SMC_SFSELECTITEM:
584 break;
585 case 13:
586 // return tooltip
587 break;
588 case SMC_REFRESH:
589 break;
590 case SMC_DEMOTE:
591 break;
592 case SMC_PROMOTE:
593 break;
594 case 0x13:
595 break;
596 case SMC_DEFAULTICON:
597 break;
598 case SMC_NEWITEM:
599 break;
600 case SMC_CHEVRONEXPAND:
601 break;
602 case SMC_DISPLAYCHEVRONTIP:
603 break;
604 case SMC_SETSFOBJECT:
605 break;
606 case SMC_SHCHANGENOTIFY:
607 break;
608 case SMC_CHEVRONGETTIP:
609 break;
610 case SMC_SFDDRESTRICTED:
611 break;
612 case 0x35:
613 break;
614 case 49:
615 break;
616 case 0x10000000:
617 break;
618 }
619 return S_FALSE;
620}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder *lpFolder, LPCITEMIDLIST lpApidl)
Definition: ordinal.c:3060
#define S_OK
Definition: intsafe.h:52
#define FCIDM_MENU_FAVORITES
Definition: shlobj.h:639
@ SMIM_ICON
Definition: shobjidl.idl:2778
@ SMIM_FLAGS
Definition: shobjidl.idl:2777
@ SMIF_DROPCASCADE
Definition: shobjidl.idl:2794
@ SMIF_TRACKPOPUP
Definition: shobjidl.idl:2797
PUITEMID_CHILD pidlItem
Definition: shobjidl.idl:2748
IShellFolder * psf
Definition: shobjidl.idl:2749
DWORD dwMask
Definition: shobjidl.idl:2759
DWORD dwFlags
Definition: shobjidl.idl:2761
#define SMC_EXEC
Definition: undocshell.h:755
#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:1743

◆ 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:2739
IUnknown * punk
Definition: shobjidl.idl:2746
HMENU hmenu
Definition: shobjidl.idl:2741
DWORD dwFlags
Definition: shobjidl.idl:2740

◆ GetObject()

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

Definition at line 479 of file internettoolbar.cpp.

480{
481 CComPtr<IShellMenu> parentMenu;
482 CComPtr<IShellMenu> newMenu;
483 CComPtr<IShellFolder> favoritesFolder;
484 LPITEMIDLIST favoritesPIDL;
485 HWND ownerWindow;
486 HMENU parentHMenu;
487 HMENU favoritesHMenu;
488 HKEY orderRegKey;
489 DWORD disposition;
490 HRESULT hResult;
491 static const TCHAR szFavoritesKey[] =
492 _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites");
493
494 if (!IsEqualIID(riid, IID_IShellMenu))
495 return E_FAIL;
496 if (psmd->uId != FCIDM_MENU_FAVORITES)
497 return E_FAIL;
498
499 // create favorites menu
500 hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
501 if (FAILED_UNEXPECTEDLY(hResult))
502 return hResult;
503 hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
504 if (FAILED_UNEXPECTEDLY(hResult))
505 return hResult;
506 favoritesHMenu = GetSubMenu(parentHMenu, 3);
507 if (favoritesHMenu == NULL)
508 return E_FAIL;
509
510 if (fFavoritesMenu.p == NULL)
511 {
512 hResult = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &newMenu));
513 if (FAILED_UNEXPECTEDLY(hResult))
514 return hResult;
515 hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
516 if (FAILED_UNEXPECTEDLY(hResult))
517 return hResult;
518
519 RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
520 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
521
522 hResult = GetFavoritesFolder(&favoritesFolder, &favoritesPIDL);
523 if (FAILED_UNEXPECTEDLY(hResult))
524 return hResult;
525
526 hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
527 if (favoritesPIDL)
528 ILFree(favoritesPIDL);
529
530 if (FAILED(hResult))
531 return hResult;
532
533 fFavoritesMenu = newMenu;
534 }
535
536 hResult = fFavoritesMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
537 if (FAILED_UNEXPECTEDLY(hResult))
538 return hResult;
539
540 return fFavoritesMenu->QueryInterface(riid, ppvObject);
541}
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:946
#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:2092

◆ 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 49 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: