windows 7 - How can I associate multiple context menu types for one file extension in the registry?

I want to add custom context menu options for certain file extensions (like .zip-files) for a program I'm developing. However on many (but not all) PCs my software is going to be installed on 7-Zip is installed as well and therefore [HKEY_CLASSES_ROOT.zip] is referring to [HKEY_CLASSES_ROOT\7-Zip.zip] in the registry.

As I don't want to tamper with the original 7-Zip installation I just want to add my context menu options on top. However entries in [HKEY_CLASSES_ROOT.zip\shell] are without effect and I don't know how I could link [HKEY_CLASSES_ROOT.zip] to [HKEY_CLASSES_ROOT\MyApp.zip] because the default value of [HKEY_CLASSES_ROOT.zip] is already being used by 7-Zip.

Any help would be greatly appreciated :)

3 Answers

  1. Jack- Reply

    2019-11-15

    If the .zip files are your only concern, you may safely use the [HKEY_CLASSES_ROOT\CompressedFolder] key.

    This is because Windows natively uses this key for it's .zip-related functionality, and 3rd party software products (including 7zip) mostly tend to share this key with Microsoft. It allows the developers to add their own functionality while preserving the native Windows "folder-like" handling of .zip files.

    It's weird though, that your [HKEY_CLASSES_ROOT\.zip] default value refers to [HKEY_CLASSES_ROOT\7-Zip.zip]. It is yet possible, that even those old versions set correct [HKEY_CLASSES_ROOT\CompressedFolder] entries - you'd have to check.

  2. Jackson- Reply

    2019-11-15

    From what I observe on my computer, you may safely "hijack" the .zip extension.

    I have installed WinZip before 7Zip, so it was WinZip that took over the .zip extension, while 7Zip left it strictly alone.

    However, 7Zip still works perfectly for me for .zip files, because it also installs a general extension for all file-types which does catch .zip files (among others).

    In effect, in my opinion 7Zip taking over also the .zip extension is an overkill.

  3. Jacob- Reply

    2019-11-15

    Ok, I'm going to try say this the easy way.. First, in HKCR, create a key for your program. (Hint, just copy and rename one..) It needs to have 3 parts minimum. CFG.File\shell\Open\command (Default) "%1"

    The 3 are: ProgID In my example it's CFG.File Action In my example it's a Shell Command to Open (and you add "%1" to include your object)

    Next, you need to create if it does not exist, this key on the file type OpenWithProgids now here's a tip: also create a key off OpenWithProgids, called Shared

    The key Shared tells Windows to not allow any ProgID to gain control or become Default.

    Now, all you need is to add your ProgID you made in HKCR. Add it's name to OpenWithProgids You can choose: either a Binary entry or the quaint String. You only need to name it, and no value.

    I did not cover all the options for the UI and Eye Candy, but I must add this as a final thought: if the file type or any key has an EditFlags entry -- Rename it or your modifications will never show...

    Oh, one last Tip: if you are having troubles trying to change a file type icon, have a look under the ShellEx key and see if it has a DefaultIcon key there. These file types are protected by Windows. If you modify or remove the entry, Windows' will reset it every reboot. (Unless you grab ownership of the entire key, then Deny TI and System access to Change Owner or Change Permissions.

    Good luck sir!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>