Re: Add a context menu item to Windows Explorer (Win98) with VB6?

Thanks for the info. I guess I assume that anyone
who would use my software is running under
admin. rights, especially if they're doing things like
adding custom context menu items. It's interesting to
know there's the HKCU option, though. Apparently
that's NT-only. I tested a setting under HKCU on Win98
and it has no effect, even though there is an
HKCU\Software\Classes key.

I suppose that if one expects to be serving people who
are going to run in "lackey mode" then it probably does
no harm to just write both values on all Windows versions
for good measure.

| You mean it just doesn't work or are you talking
| about the difficulty in writing to HKCR?

Difficulty writing to HKCR. I should have clarified, my bad. The concept
will work with the data in HKCR, but attempting to write it there via VB
will not, at least as a compiled EXE without admin rights. Because VB6
needs to run as admin under Vista, it will perform those taks without
question from the a compiled EXE without admin privs, it won't.
error messages, it just wont (in my experience anyway)

| How can it be done under HKCU? You mean that you
| can use the HKCU\Software\Classes subkey in Vista to
| augment or override the HKCR key?

Yes. It's actually documented in the MSDN (although I cannot find it
offhand, I can search for it if you want me too). When I was working on
manifest injection utility, I wanted to add a context menu option in
Explorer to via a file's manifest when right-clicking over any given EXE
file. The obvious solution was
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\exefile\shell\View Manifest\command

Worked fine in XP/200, but under Vista it wasn't happening with admin
So I buried myself in the MSDN and the article said that the same code
*would* work under HKCU and because it was a per user setting took
presidence over any similiar setting under HKLM (which is where the HKCR

::pauses for 15 minutes or so::

Okay, I found it...I wanted to make sure I was not givng you bad
(or as it's known around here, pulling a McWilly). Here is the article
( and a clip of the pertinent

information that is stored here makes sure that the correct program opens
when you open a file by using Windows Explorer. This key is sometimes
abbreviated as "HKCR." Starting with Windows 2000, this information is
stored under both the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER keys. The
HKEY_LOCAL_MACHINE\Software\Classes key contains default settings that can
apply to all users on the local computer. The
HKEY_CURRENT_USER\Software\Classes key contains settings that override the
default settings and apply only to the interactive user. The
HKEY_CLASSES_ROOT key provides a view of the registry that merges the
information from these two sources. HKEY_CLASSES_ROOT also provides this
merged view for programs that are designed for earlier versions of
To change the settings for the interactive user, changes must be made
HKEY_CURRENT_USER\Software\Classes instead of under HKEY_CLASSES_ROOT. To
change the default settings, changes must be made under
HKEY_LOCAL_MACHINE\Software\Classes. If you write keys to a key under
HKEY_CLASSES_ROOT, the system stores the information under
HKEY_LOCAL_MACHINE\Software\Classes. If you write values to a key under
HKEY_CLASSES_ROOT, and the key already exists under
HKEY_CURRENT_USER\Software\Classes, the system will store the information
there instead of under HKEY_LOCAL_MACHINE\Software\Classes.

Okay, so there we go. Since Vista guidelines perfer user-by-user data
instead of the global approach, HKCU is probably the best route to go.
FWIW, I have done this and it works fine.

- Kev