I have an MFC (VS 2010) application that uses both CMFCShellTreeCtrl and CMFCShellListCtrl objects in an Explorer-like implementation. After testing on Windows XP and Windows 7, I've discovered that CMFCShellListCtrl::OnContextMenu does not handle the 'Delete' operation in Windows 7. The HRESULT value is -2144927744 after the InvokeCommand call in afxshelllistctrl.cpp on line 994. The context menu does appear and all other context menu operations work - except the Delete handler. The Delete operation does work in the CMFCShellTreeCtrl object. Here is a summary:
hr = -2144927744 always ('Delete File' user prompt never appears on Windows 7)
hr = S_OK when 'Yes' is selected on 'Delete Folder' user prompt
hr = -2144927744 when 'No' is selected on 'Delete Folder' user prompt
When debugging, the values for the CMINVOKECOMMANDINFO object are setup the same for both the shell list and tree controls. Even the idCmd value (18) is the same in both instances.
This HRESULT value seems to equate to 0x80270000: COPYENGINE_E_USER_CANCELLED (User canceled the current action), although their certainly was no UI action that was displayed (i.e. Delete File message prompt).
All of this works correctly in Windows XP, but Delete does not get invoked on the CMFCShellListCtrl object in Windows 7.
I also get the exact same results when using a Visual Studio sample project.
I have also tried using the ShellExView (by Nir Sofer) tool to view and manage all installed shell extensions, but after disabling most of the extensions, I could not isolate the problem any further.
More observations noted:
1) Running the app as Administrator does not fix the problem
2) Problem is observed on multiple Windows 7 machines (corporate and home computers)
3) All other context menu handlers do work (Open, Edit, Properties, etc.) - except the Delete handler
4) The Delete handler does work in CMFCShellTreeCtrl