5

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 :)

  • See if you can find another extension for a file type that has the behavior you want and use it as a template for what you're trying to do. – martineau Sep 9 '13 at 18:32
  • The problem is that other examples I found don't do it like 7-Zip. For example Gimp just writes itself into [HKEY_CLASSES_ROOT\pngfile\shell] for its context menu entry for .pngs. It seems that 7-Zip sort of hijacks the .zip extension, and I don't know a workaround but need one... – Sebastian Sep 10 '13 at 8:53
1

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.

  • this is not exactly what i wanted. – eramit2010 Feb 4 '14 at 9:06
0

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.

  • but it will display context menu of only latest or say default app. i want to display context menu of both. – eramit2010 Jan 28 '14 at 10:45
  • It displays both. I have both WinZip and 7Zip displayed for .zip files : WinZip via HKEY_CLASSES_ROOT\.zip and 7Zip via its general extension. Another idea for you is to develop a general/catch-all extension without hijacking anything. The disadvantage will be that your handler will always be invoked for any right-click on ALL files (it can decide to display nothing for non-zip files). The advantage is that you touch nothing of 7Zip in the registry. – harrymc Jan 28 '14 at 11:35
  • i know about all extension but that is not proper solution for my problem. i want to add new entry in right click menu of .zip file using registry. i can do it by adding it in registry of default application. menu is not showing after installing another application. – eramit2010 Jan 28 '14 at 12:07
  • I have listed here the two solutions that I know about: hijacking the file-extension or catch-all. I don't know of a third solution. – harrymc Jan 28 '14 at 13:07
  • thanks for two solution but i already knew these. – eramit2010 Jan 28 '14 at 13:10
-3

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!!

  • -1. "I'm going to try say this the easy way" – I guess it was easy for you to say (write) this in a chaotic manner, with questionable punctuation and without formatting, and like in a hurry. It's not easy for us to read and understand: what is a key name or path, which words are casual and which belong to some meaningful name, what is what, what goes where, etc. – Kamil Maciorowski Dec 16 '17 at 8:24
  • I'm sorry, I thought I was speaking along with others in "context" with what has been said already. Given the history of the dialogue above, I was only adding the simplest answer to address the original question. That said, it appeared to me that "they" are familiar with the registry and would be comfortable with what I was describing. Forgive me if I mispoke. – EdgeClub Dec 20 '17 at 5:01
  • There's no dialogue. It's Q&A site, not a forum. There's the question and there's your answer, which should be standalone. You can mention other answers or comments, but please make it clear, (e.g. "Joe's answer [link] is obsolete, nowadays it's better to…"). In my opinion the main issue with your answer is the lack of proper formatting; it would benefit from `backticks`. This other answer does it quite right. When (if) you fix your answer, then please leave me a comment (starting with @KamilMaciorowski), and I will retract my downvote. – Kamil Maciorowski Dec 20 '17 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.