Windows资源管理器:如何创建其他按钮? [英] Windows Explorer: How to create additional button?

查看:87
本文介绍了Windows资源管理器:如何创建其他按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 7的资源管理器使用一个新的浅蓝色栏,带有组织",共享",新文件夹"等按钮.

Explorer of Windows 7 uses a new light-blue bar with buttons like "Organize", "Share", "New Folder" etc.

如何创建新按钮?我是否需要为explorer.exe创建一个插件,如果要怎么做(使用Visual Studio .NET)?

How can I create a new button ? Do I need to create a plugin for explorer.exe, and if, how do I do it (using Visual Studio .NET) ?

还是我必须设置一个指向exe或bat的简单注册表项?

Or is it a simple registry key I have to set which points to an exe or bat?

提前致以最诚挚的问候

推荐答案

这是一个注册表项,但并不是那么简单.您必须执行几个步骤才能添加一个按钮.

It's a registry key, but not quite so simple. You have to do several steps to add one button.

您可能已经注意到Win7 Explorer会调整其工具栏以匹配所显示的内容.例如,控制面板文件夹中显示的按钮与文档或音乐库文件夹中显示的按钮不同.您可以在注册表项下找到一大堆不同的文件夹类型

You may have noticed that the Win7 Explorer adjusts its toolbar to match the content that is being displayed. For example the buttons shown for the control panel folders are different than the ones for documents or the music library folder. You can find a large list of different folder types under the registry key

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes

单击此处显示的每个UID,以了解其适用的文件夹类型.例如,在这里您可以看到通用库类型中的文件夹条目:

Click on each UID shown there to find out what folder type it is for. For example here you see the entry for folders in the generic library type:

因此,您要做的第一件事是找到要为其添加自己的按钮的文件夹类型.

So the first thing you have to do is to find the folder type for which you want to add your own button.

找到正确的UID后,您可能必须拥有这些密钥的所有权.否则,您将无法修改它们: 右键单击该键,然后选择权限...".

Once you found the right UID, you might have to take ownership of those keys. Otherwise you won't be able to modify them: Right-click on that key and choose Permisssions...

  1. 单击高级"按钮.
  2. 点击所有者标签.
  3. 在更改所有者"下:选择管理员.
    单击应用",并验证当前所​​有者"是否设置为管理员". 单击确定"保存更改.
  4. 返回权限"对话框,单击管理员",然后单击(进行检查)完全控制"
  5. 单击确定"以保存设置并关闭对话框.
  1. Click the Advanced button.
  2. Click the Owner tab.
  3. Under Change Owner to: select Administrators.
    Click Apply and verify that "Current Owner" is set to Administrators. Click OK to save the change.
  4. Back in the Permissions dialog, click Administrators and then click (to check it) Full Control
  5. Click OK to save the settings and close the dialog box.

下一步是创建您自己的按钮所需的键和值:

The next step is to create the keys and values necessary for your own button:

  • 添加新键,TasksItemsSelected
  • 添加新密钥TasksItemsSelected\0
  • 为您的命令创建一个新的GUID(使用guidgen.exe).
  • 添加键TasksItemsSelected\0\<yourguid>,然后添加字符串TitleInfoTip,并为其提供适当的值.您还可以在这里使用字符串Icon设置图标,其值指向图标文件.
  • 添加键TasksItemsSelected\0\<yourguid>\shell\InvokeTask\command
  • 作为命令键的默认值,输入要执行的命令.
  • Add a new key, TasksItemsSelected
  • Add a new key, TasksItemsSelected\0
  • Create a new GUID (use guidgen.exe) for your command.
  • add the key TasksItemsSelected\0\<yourguid>, then add the strings Title and InfoTip and give them the appropriate values. You can also set an icon here, using the string Icon with the value pointing to an icon file.
  • Add the keys TasksItemsSelected\0\<yourguid>\shell\InvokeTask\command
  • as default value of the command key, enter the command you want to execute.

现在您的注册表项应如下所示:

Now your registry entry should look something like this:

该命令运行时,它将至少接收两个参数值.

When the command runs, it will receive at least two parameter values.

  %1 -- The path of the folder that was being displayed
  %2 -- The pathname of the file that was selected.

如果在单击mycommand按钮之前选择了多个文件,则后续文件名将位于后续参数中.

If you select more than one file before clicking the mycommand button, then the subsequent filenames will be in subsequent parameters.

最后但并非最不重要的一点:如果要在未选择任何内容的情况下添加自己的按钮,请执行上述所有操作,但使用注册表项TasksNoItemsSelected而不是TasksItemsSelected

And last but not least: if you want to add your own button for situations where nothing is selected, do everything as mentioned above, but use the registry key TasksNoItemsSelected instead of TasksItemsSelected

这篇关于Windows资源管理器:如何创建其他按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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