ReactOS  0.4.14-dev-991-g696cdc6
CCPLItemMenu Class Reference

#include <CControlPanelFolder.h>

Inheritance diagram for CCPLItemMenu:
Collaboration diagram for CCPLItemMenu:

Public Member Functions

 CCPLItemMenu ()
 
 ~CCPLItemMenu ()
 
HRESULT WINAPI Initialize (UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
 
virtual HRESULT WINAPI QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
 
virtual HRESULT WINAPI InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
 
virtual HRESULT WINAPI GetCommandString (UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
 
virtual HRESULT WINAPI HandleMenuMsg (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 ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Attributes

PITEMID_CHILDm_apidl
 
UINT m_cidl
 

Additional Inherited Members

- Public Types inherited from IContextMenu2
typedef IContextMenu2LPCONTEXTMENU2
 
- Public Types inherited from IContextMenu
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- 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
 
- Public Attributes inherited from IContextMenu
CMIC_MASK_NOZONECHECKS typedef IContextMenuLPCONTEXTMENU
 
- Static Public Attributes inherited from IContextMenu
static CMDSTR_VIEWDETAILSW(const WCHAR []) const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 87 of file CControlPanelFolder.h.

Constructor & Destructor Documentation

◆ CCPLItemMenu()

CCPLItemMenu::CCPLItemMenu ( )

Definition at line 651 of file CControlPanelFolder.cpp.

652 {
653  m_apidl = NULL;
654  m_cidl = 0;
655 }
smooth NULL
Definition: ftsmooth.c:416
PITEMID_CHILD * m_apidl

◆ ~CCPLItemMenu()

CCPLItemMenu::~CCPLItemMenu ( )

Definition at line 667 of file CControlPanelFolder.cpp.

668 {
670 }
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2621
PITEMID_CHILD * m_apidl

Member Function Documentation

◆ GetCommandString()

HRESULT WINAPI CCPLItemMenu::GetCommandString ( UINT_PTR  idCommand,
UINT  uFlags,
UINT lpReserved,
LPSTR  lpszName,
UINT  uMaxNameLen 
)
virtual

Implements IContextMenu.

Definition at line 746 of file CControlPanelFolder.cpp.

752 {
753  TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
754 
755  FIXME("unknown command string\n");
756  return E_FAIL;
757 }
UINT uFlags
Definition: api.c:59
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4

◆ HandleMenuMsg()

HRESULT WINAPI CCPLItemMenu::HandleMenuMsg ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Implements IContextMenu2.

Definition at line 762 of file CControlPanelFolder.cpp.

766 {
767  TRACE("ICPanel_IContextMenu_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
768 
769  return E_NOTIMPL;
770 }
WPARAM wParam
Definition: combotst.c:138
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99
LPARAM lParam
Definition: combotst.c:139

◆ Initialize()

HRESULT WINAPI CCPLItemMenu::Initialize ( UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl 
)

Definition at line 657 of file CControlPanelFolder.cpp.

658 {
659  m_cidl = cidl;
660  m_apidl = _ILCopyaPidl(apidl, m_cidl);
661  if (m_cidl && !m_apidl)
662  return E_OUTOFMEMORY;
663 
664  return S_OK;
665 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:59
PITEMID_CHILD * _ILCopyaPidl(PCUITEMID_CHILD_ARRAY apidlsrc, UINT cidl)
Definition: pidl.c:2638
PITEMID_CHILD * m_apidl

◆ InvokeCommand()

HRESULT WINAPI CCPLItemMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
virtual

Implements IContextMenu.

Definition at line 692 of file CControlPanelFolder.cpp.

693 {
694  HRESULT hResult;
695 
697  if(!pCPanel)
698  return E_FAIL;
699 
700  TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
701 
702  if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_OPEN)) //FIXME
703  {
704  /* Hardcode the command here; Executing a cpl file would be fine but we also need to run things like console.dll */
705  WCHAR wszParams[MAX_PATH];
706  PCWSTR wszFile = L"rundll32.exe";
707  PCWSTR wszFormat = L"shell32.dll,Control_RunDLL %s,%s";
708 
709  wsprintfW(wszParams, wszFormat, pCPanel->szName, pCPanel->szName + pCPanel->offsDispName);
710 
711  /* Note: we pass the applet name to Control_RunDLL to distinguish between multiple applets in one .cpl file */
712  ShellExecuteW(NULL, NULL, wszFile, wszParams, NULL, 0);
713  }
714  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_CREATELINK)) //FIXME
715  {
716  CComPtr<IDataObject> pDataObj;
718 
719  hResult = SHCreateDataObject(pidl, m_cidl, m_apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj));
720  if (FAILED(hResult))
721  return hResult;
722 
723  SHFree(pidl);
724 
725  //FIXME: Use SHCreateLinks
726  CComPtr<IShellFolder> psf;
727  CComPtr<IDropTarget> pDT;
728 
729  hResult = SHGetDesktopFolder(&psf);
730  if (FAILED(hResult))
731  return hResult;
732 
733  hResult = psf->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pDT));
734  if (FAILED(hResult))
735  return hResult;
736 
737  SHSimulateDrop(pDT, pDataObj, MK_CONTROL|MK_SHIFT, NULL, NULL);
738  }
739  return S_OK;
740 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
const uint16_t * PCWSTR
Definition: typedefs.h:56
#define MK_SHIFT
Definition: winuser.h:2344
HRESULT WINAPI SHCreateDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IDataObject *pdtInner, REFIID riid, void **ppv)
static PIDLCPanelStruct * _ILGetCPanelPointer(LPCITEMIDLIST pidl)
WCHAR szName[1]
Definition: pidl.h:116
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define IDS_OPEN
Definition: resource.h:12
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
smooth NULL
Definition: ftsmooth.c:416
WORD offsDispName
Definition: pidl.h:114
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define MAX_PATH
Definition: compat.h:26
#define IDS_CREATELINK
Definition: shresdef.h:206
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define MK_CONTROL
Definition: winuser.h:2345
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2250
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1617
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
PITEMID_CHILD * m_apidl
BOOL WINAPI SHSimulateDrop(IDropTarget *pDrop, IDataObject *pDataObj, DWORD grfKeyState, PPOINTL lpPt, DWORD *pdwEffect)
Definition: ordinal.c:1775

◆ QueryContextMenu()

HRESULT WINAPI CCPLItemMenu::QueryContextMenu ( HMENU  hMenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
virtual

Implements IContextMenu.

Definition at line 672 of file CControlPanelFolder.cpp.

678 {
680  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_SEPARATOR, NULL, MFS_ENABLED);
682 
683  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 2);
684 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
#define MFS_DEFAULT
Definition: winuser.h:743
#define IDS_OPEN
Definition: resource.h:12
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFS_ENABLED
Definition: winuser.h:745
smooth NULL
Definition: ftsmooth.c:416
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
#define MFT_SEPARATOR
Definition: winuser.h:739
#define IDS_CREATELINK
Definition: shresdef.h:206
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Member Data Documentation

◆ m_apidl

PITEMID_CHILD* CCPLItemMenu::m_apidl
private

Definition at line 92 of file CControlPanelFolder.h.

Referenced by CCPLItemMenu(), Initialize(), InvokeCommand(), and ~CCPLItemMenu().

◆ m_cidl

UINT CCPLItemMenu::m_cidl
private

Definition at line 93 of file CControlPanelFolder.h.

Referenced by CCPLItemMenu(), Initialize(), InvokeCommand(), and ~CCPLItemMenu().


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