How do you handle rename operations when calling IContextMenu?

半腔热情 提交于 2019-12-25 04:09:15

问题


I'm calling IContextMenu::QueryContextMenu with CMF_CANRENAME and I'm having problems handling the rename operation when calling IContextMenu::InvokeCommand on Windows XP.

I'm not a namespace extension and I'm not using DefView/IShellView but I am providing a site that implements IServiceProvider.

On newer versions of Windows I'm queried for a service that implements IFolderView2 and the shell calls IFolderView2::DoRename and I can start the rename operation.

On Windows XP however it queries for the SID_DefView service but I cannot find any information about how I'm supposed to implement that service.

The interface it (SHELL32!CDefFolderMenu::_ProcessRename) is asking for is {985F64F0-D410-4E02-BE22-DA07F2B5C5E1} and I can see in the registry that this is the IID for IDefViewFrame3 but it seems to be undocumented! IDefViewFrame on the other hand is documented but the only thing MSDN says is "Used only for its IUnknown functionality. It has no methods of its own.".

Is there a documented way to handle rename operations on XP in this situation?

I don't really want to fake a IDefViewFrame3 interface but the only other option I can think of is to see if it is the rename verb and just handle it myself after TrackPopupMenu.


回答1:


IDefViewFrame3 looks like this after IUnknown on Windows XP:

STDMETHOD(GetWindowLV)(THIS_ HWND*phwnd) PURE;
STDMETHOD(ShowHideListView)(THIS) PURE;
STDMETHOD(OnResizeListView)(THIS) PURE;
STDMETHOD(ReleaseWindowLV)(THIS) PURE;
STDMETHOD(DoRename)(THIS) PURE;

and DoRename is called by DefView inside InvokeCommand but since it is so obscure and undocumented it is unlikely that all 3rd-party namespace extensions handle it correctly so even if you implement IDefViewFrame3 you still have to check for the rename verb if InvokeCommand fails.



来源:https://stackoverflow.com/questions/40497455/how-do-you-handle-rename-operations-when-calling-icontextmenu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!