简体   繁体   中英

Registering Context Menu in WiX MSI Installer

I want to create a context menu something like the menu in 7-Zip using C#. How can I register the dll using WiX?

在此处输入图片说明

Step one is to learn how to do it by hand. This involves creating a Shell Extension, and registering it . 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. Additionally, after writing that registry key, you have to call SHChangeNotify with SHCNE_ASSOCCHANGED , or reboot.

If your needs are simpler than the 7-zip case, you can likely just register a Verb or File Association instead.

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. If you're registering a shell extension, I believe you have to create the registry keys directly through the RegistryKey and RegistryValue elements.

For more concrete examples of the WiX authoring, see the answers to How to register file types/extensions with a WiX installer? and How to associate application with existing file types using WiX installer?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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