如何使用基于IExecuteCommand的Shell扩展来使某些上下文菜单选项变灰? [英] How to gray out some context-menu options with an IExecuteCommand-based shell extension?

查看:166
本文介绍了如何使用基于IExecuteCommand的Shell扩展来使某些上下文菜单选项变灰?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 IExecuteCommand 方法实现上下文菜单外壳扩展时(如此博客文章),如何将给定的菜单选项显示为灰色?

When implementing a context-menu shell extension using the IExecuteCommand approach (as described in this blog post), how can a given menu option be grayed out?

例如假设shell扩展提供了一些菜单选项,并且应根据shell扩展计算的某些状态和条件将其中的某些菜单选项显示为灰色,例如:如果用户右键单击文件,并且shell扩展检测到该文件,具有某些给定的属性,一些shell扩展上下文菜单选项应显示为灰色。

E.g. Suppose that the shell extension offers some menu options, and some of them should be grayed out basing on some state and conditions that the shell extension computes, for example: if the user right-clicks on a file and the shell extension detects that this file has some given properties, some of the shell extension context menu options should be grayed out.

如何使用 IExecuteCommand

还是应该使用另一个Windows Shell COM接口?

Or should another Windows Shell COM interface be used for that purpose?

推荐答案

我从没有尝试过,但是您应该能够在动词的键中将 CommandStateHandler (未记录?)设置为实现 IExplorerCommandState

I have never tried this but you should be able to set CommandState­Handler (undocumented?) in your verb's key to a CLSID that implements IExplorerCommandState.

您可能还会考虑实施使用IExplorerCommand 而不是IExecuteCommand + IExplorerCommandState ...

You might also think about implementing IExplorerCommand instead of IExecuteCommand+IExplorerCommandState...

您还可以根据对属性系统的查询,使用<$ c $隐藏动词c> ApplyTo 值。

You can also hide verbs based on a query to the property system with the AppliesTo value.

这篇关于如何使用基于IExecuteCommand的Shell扩展来使某些上下文菜单选项变灰?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆