ReactOS  0.4.15-dev-4914-g2220e56
CRecycleBinItemContextMenu Class Reference
Inheritance diagram for CRecycleBinItemContextMenu:
Collaboration diagram for CRecycleBinItemContextMenu:

Public Member Functions

 CRecycleBinItemContextMenu ()
 
 ~CRecycleBinItemContextMenu ()
 
HRESULT WINAPI Initialize (LPCITEMIDLIST pidl)
 
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

LPITEMIDLIST apidl
 

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 133 of file CRecycleBin.cpp.

Constructor & Destructor Documentation

◆ CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::CRecycleBinItemContextMenu ( )

Definition at line 336 of file CRecycleBin.cpp.

337 {
338  apidl = NULL;
339 }
#define NULL
Definition: types.h:112

◆ ~CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::~CRecycleBinItemContextMenu ( )

Definition at line 341 of file CRecycleBin.cpp.

342 {
343  ILFree(apidl);
344 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925

Member Function Documentation

◆ GetCommandString()

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

Implements IContextMenu.

Definition at line 442 of file CRecycleBin.cpp.

443 {
444  TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
445 
446  return E_FAIL;
447 }
UINT uFlags
Definition: api.c:59
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4

◆ HandleMenuMsg()

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

Implements IContextMenu2.

Definition at line 449 of file CRecycleBin.cpp.

450 {
451  TRACE("CRecycleBin_IContextMenu2Item_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
452 
453  return E_NOTIMPL;
454 }
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 CRecycleBinItemContextMenu::Initialize ( LPCITEMIDLIST  pidl)

Definition at line 346 of file CRecycleBin.cpp.

347 {
348  apidl = ILClone(pidl);
349  if (apidl == NULL)
350  return E_OUTOFMEMORY;
351  return S_OK;
352 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112

◆ InvokeCommand()

HRESULT WINAPI CRecycleBinItemContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
virtual

Implements IContextMenu.

Definition at line 392 of file CRecycleBin.cpp.

393 {
395  WCHAR szDrive[8];
396 
397  TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
398 
399  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb == MAKEINTRESOURCEA(5))
400  {
401  Context.pFileDetails = _ILGetRecycleStruct(apidl);
402  Context.bFound = FALSE;
403 
404  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
405  {
406  ERR("GetEnvironmentVariableW failed\n");
407  return E_FAIL;
408  }
409  PathAddBackslashW(szDrive);
410 
412  if (!Context.bFound)
413  return E_FAIL;
414 
415  BOOL ret = TRUE;
416 
417  /* restore file */
418  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
419  ret = RestoreFile(Context.hDeletedFile);
420  /* delete file */
421  else
423 
424  CloseRecycleBinHandle(Context.hDeletedFile);
425 
426  return (ret ? S_OK : E_FAIL);
427  }
428  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3))
429  {
430  FIXME("implement cut\n");
431  return E_NOTIMPL;
432  }
433  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7))
434  {
435  FIXME("implement properties\n");
436  return E_NOTIMPL;
437  }
438 
439  return S_OK;
440 }
#define TRUE
Definition: types.h:120
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HANDLE hDeletedFile)
Definition: recyclebin.c:93
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
BOOL WINAPI RestoreFile(IN HANDLE hDeletedFile)
Definition: recyclebin.c:392
static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
int ret
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define E_NOTIMPL
Definition: ddrawi.h:99
struct tagContext Context
Definition: acpixf.h:1034
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:614

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 354 of file CRecycleBin.cpp.

355 {
356  WCHAR szBuffer[30] = {0};
357  ULONG Count = 1;
358 
359  TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
360 
361  if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, _countof(szBuffer)))
362  {
363  szBuffer[_countof(szBuffer)-1] = L'\0';
364  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
365  Count++;
366  }
367 
368  if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, _countof(szBuffer)))
369  {
370  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
371  szBuffer[_countof(szBuffer)-1] = L'\0';
372  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
373  }
374 
375  if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, _countof(szBuffer)))
376  {
377  szBuffer[_countof(szBuffer)-1] = L'\0';
378  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
379  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
380  }
381 
382  if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, _countof(szBuffer)))
383  {
384  szBuffer[_countof(szBuffer)-1] = L'\0';
385  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
386  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
387  }
388 
389  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
390 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_CUT
Definition: shresdef.h:223
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
#define IDS_RESTORE
Definition: shresdef.h:224
#define IDS_PROPERTIES
Definition: resource.h:101
UINT uFlags
Definition: api.c:59
#define MFS_DEFAULT
Definition: winuser.h:743
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define L(x)
Definition: ntvdm.h:50
#define MFS_ENABLED
Definition: winuser.h:745
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
int Count
Definition: noreturn.cpp:7
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MFT_SEPARATOR
Definition: winuser.h:739
#define shell32_hInstance
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define IDS_DELETE
Definition: resource.h:40

Member Data Documentation

◆ apidl

LPITEMIDLIST CRecycleBinItemContextMenu::apidl
private

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