ReactOS 0.4.15-dev-7705-g2320c37
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 655 of file CControlPanelFolder.cpp.

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

◆ ~CCPLItemMenu()

CCPLItemMenu::~CCPLItemMenu ( )

Definition at line 671 of file CControlPanelFolder.cpp.

672{
674}
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2661

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

756{
757 TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
758
759 FIXME("unknown command string\n");
760 return E_FAIL;
761}
#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 766 of file CControlPanelFolder.cpp.

770{
771 TRACE("ICPanel_IContextMenu_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
772
773 return E_NOTIMPL;
774}
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 661 of file CControlPanelFolder.cpp.

662{
663 m_cidl = cidl;
664 m_apidl = _ILCopyaPidl(apidl, m_cidl);
665 if (m_cidl && !m_apidl)
666 return E_OUTOFMEMORY;
667
668 return S_OK;
669}
#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:2678

◆ InvokeCommand()

HRESULT WINAPI CCPLItemMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
virtual

Implements IContextMenu.

Definition at line 696 of file CControlPanelFolder.cpp.

697{
698 HRESULT hResult;
699
701 if(!pCPanel)
702 return E_FAIL;
703
704 TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
705
706 if (lpcmi->lpVerb == MAKEINTRESOURCEA(0))
707 {
708 /* Hardcode the command here; Executing a cpl file would be fine but we also need to run things like console.dll */
709 WCHAR wszParams[MAX_PATH];
710 PCWSTR wszFile = L"rundll32.exe";
711 PCWSTR wszFormat = L"shell32.dll,Control_RunDLL %s,%s";
712
713 wsprintfW(wszParams, wszFormat, pCPanel->szName, pCPanel->szName + pCPanel->offsDispName);
714
715 /* Note: we pass the applet name to Control_RunDLL to distinguish between multiple applets in one .cpl file */
716 ShellExecuteW(NULL, NULL, wszFile, wszParams, NULL, 0);
717 }
718 else if (lpcmi->lpVerb == MAKEINTRESOURCEA(1)) //FIXME
719 {
720 CComPtr<IDataObject> pDataObj;
722
723 hResult = SHCreateDataObject(pidl, m_cidl, m_apidl, NULL, IID_PPV_ARG(IDataObject, &pDataObj));
724 if (FAILED(hResult))
725 return hResult;
726
727 SHFree(pidl);
728
729 //FIXME: Use SHCreateLinks
730 CComPtr<IShellFolder> psf;
731 CComPtr<IDropTarget> pDT;
732
733 hResult = SHGetDesktopFolder(&psf);
734 if (FAILED(hResult))
735 return hResult;
736
737 hResult = psf->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pDT));
738 if (FAILED(hResult))
739 return hResult;
740
741 SHSimulateDrop(pDT, pDataObj, MK_CONTROL|MK_SHIFT, NULL, NULL);
742 }
743 return S_OK;
744}
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:1824
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1646
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2379
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:2368
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define MK_CONTROL
Definition: winuser.h:2369
#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 676 of file CControlPanelFolder.cpp.

682{
683 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst, MFT_STRING, MAKEINTRESOURCEW(IDS_OPEN), MFS_DEFAULT);
685 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED);
686
687 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 2);
688}
#define IDC_STATIC
Definition: resource.h:4
#define IDS_OPEN
Definition: resource.h:18
#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:221
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MFS_DEFAULT
Definition: winuser.h:748
#define MFS_ENABLED
Definition: winuser.h:750
#define MFT_STRING
Definition: winuser.h:746
#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: