ReactOS 0.4.15-dev-6056-gb29b268
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 ()
 
HRESULT HandleMenuMsg ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
- 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 IContextMenuLPCONTEXTMENU
 
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
 
- Static Public Attributes inherited from IContextMenu
static 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 656 of file CControlPanelFolder.cpp.

657{
658 m_apidl = NULL;
659 m_cidl = 0;
660}
PITEMID_CHILD * m_apidl
#define NULL
Definition: types.h:112

◆ ~CCPLItemMenu()

CCPLItemMenu::~CCPLItemMenu ( )

Definition at line 672 of file CControlPanelFolder.cpp.

673{
675}
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2650

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 751 of file CControlPanelFolder.cpp.

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

◆ HandleMenuMsg()

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

Implements IContextMenu2.

Definition at line 767 of file CControlPanelFolder.cpp.

771{
772 TRACE("ICPanel_IContextMenu_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
773
774 return E_NOTIMPL;
775}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Initialize()

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

Definition at line 662 of file CControlPanelFolder.cpp.

663{
664 m_cidl = cidl;
665 m_apidl = _ILCopyaPidl(apidl, m_cidl);
666 if (m_cidl && !m_apidl)
667 return E_OUTOFMEMORY;
668
669 return S_OK;
670}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
PITEMID_CHILD * _ILCopyaPidl(PCUITEMID_CHILD_ARRAY apidlsrc, UINT cidl)
Definition: pidl.c:2667

◆ InvokeCommand()

HRESULT WINAPI CCPLItemMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
virtual

Implements IContextMenu.

Definition at line 697 of file CControlPanelFolder.cpp.

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

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 677 of file CControlPanelFolder.cpp.

683{
684 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst, MFT_STRING, MAKEINTRESOURCEW(IDS_OPEN), MFS_DEFAULT);
686 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED);
687
688 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 2);
689}
#define IDC_STATIC
Definition: resource.h:4
#define IDS_OPEN
Definition: resource.h:12
#define TRUE
Definition: types.h:120
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_CREATELINK
Definition: shresdef.h:220
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFT_SEPARATOR
Definition: winuser.h:739
#define MFS_DEFAULT
Definition: winuser.h:743
#define MFS_ENABLED
Definition: winuser.h:745
#define MFT_STRING
Definition: winuser.h:741
#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: