简体   繁体   English

在WiX MSI安装程序中注册上下文菜单

[英]Registering Context Menu in WiX MSI Installer

I want to create a context menu something like the menu in 7-Zip using C#. 我想使用C#创建类似于7-Zip中的菜单的上下文菜单。 How can I register the dll using WiX? 如何使用WiX注册dll?

在此处输入图片说明

Step one is to learn how to do it by hand. 第一步是学习手工操作。 This involves creating a Shell Extension, and registering it . 这涉及创建Shell扩展并进行注册 Per MSDN, you do this by implementing IContextMenu and listing its CLSID in a subkey of the registry key HKEY_CLASSES_ROOT\\ ProgID \\ShellEx\\ContextMenuHandlers. 对于MSDN,您可以通过实现IContextMenu并将其CLSID列出在注册表项HKEY_CLASSES_ROOT \\ ProgID \\ ShellEx \\ ContextMenuHandlers中来实现。 Additionally, after writing that registry key, you have to call SHChangeNotify with SHCNE_ASSOCCHANGED , or reboot. 此外,在写入该注册表项之后,您必须使用SHCNE_ASSOCCHANGED调用SHChangeNotify或重新启动。

If your needs are simpler than the 7-zip case, you can likely just register a Verb or File Association instead. 如果您的需求比7压缩包简单,则可以注册一个动词或文件关联

Once you've done this, and tested it on your development machine, you're ready for step 2: make it part of your installer. 完成此步骤并在开发计算机上对其进行测试后,即可开始第二步:将其纳入安装程序的一部分。 If you're creating a verb or file association, that's possible with native Windows Installer tables, as exposed through the ProgId , Extension , and Verb elements. 如果要创建动词或文件关联,则可以通过ProgIdExtensionVerb元素公开使用本机Windows Installer表。 If you're registering a shell extension, I believe you have to create the registry keys directly through the RegistryKey and RegistryValue elements. 如果您正在注册Shell扩展,我相信您必须直接通过RegistryKeyRegistryValue元素创建注册表项。

For more concrete examples of the WiX authoring, see the answers to How to register file types/extensions with a WiX installer? 有关WiX创作的更多具体示例,请参阅“ 如何使用WiX安装程序注册文件类型/扩展名?”的答案 and How to associate application with existing file types using WiX installer? 以及如何使用WiX安装程序将应用程序与现有文件类型相关联?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM