Solved

Adding shell extensions to registry

Posted on 1997-09-10
5
1,175 Views
Last Modified: 2013-12-03
I'm trying to add menu items to the desktop's context menu.
I _think_ I have the necessary code, but I can't figure out
how to get the shell to initialize the DLL.  My guess is
I'm doing something wrong in the registry, but I'm stuck.
Below is what I'm using for a .REG file.  Please let me
know if there's anything wrong here.  Thanks in advance.  
(Please excuse the formatting of the .REG file.)

-----------------------------------------------------------
------------
REGEDIT4

[HKEY_CLASSES_ROOT\CLSID\{4d7e1cc0-292e-11d1-ab10-004005228
c6a}]
   @="Shell Extension Sample"
[HKEY_CLASSES_ROOT\CLSID\{4d7e1cc0-292e-11d1-ab10-004005228
c6a}\InProcServer32]
   @="c:\\src\\shellext\\shellext.dll"
     "ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{00021400-0000-0000-c000-000000000
046}\ShellEx\ContextMenuHandlers]
   @="SESMenu"
[HKEY_CLASSES_ROOT\CLSID\{00021400-0000-0000-c000-000000000
046}\ShellEx\ContextMenuHandlers\SESMenu]
   @="{4d7e1cc0-292e-11d1-ab10-004005228c6a}"
[HKEY_CLASSES_ROOT\CLSID\{00021400-0000-0000-c000-000000000
046}\ShellEx\PropertySheetHandlers]
   @="SESProp"
[HKEY_CLASSES_ROOT\CLSID\{00021400-0000-0000-c000-000000000
046}\ShellEx\PropertySheetHandlers\SESProp]
   @="{4d7e1cc0-292e-11d1-ab10-004005228c6a}"

-----------------------------------------------------------
----------

0
Comment
Question by:twh270
  • 2
  • 2
5 Comments
 

Expert Comment

by:mattyg102096
ID: 1406472
So, you are trying to add an item to the Desktop menu, and then add property sheets to the Display Properties dialog that comes up if you select Properties.  Right?

Well, I cheated an looked at where my video card drivers (Matrox) make Registry entries for the property sheets.  The drivers add 2 sheets to my Display settings.

Well, it seems that for the Property Sheets, the proper key would be:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\Display\shellex\PropertySheetHandlers\SESProp]
@="{your CLSID here}"

Mind you, I've pulled this out of my NT registry, but since the key "path" references 'Windows' and 'Windows NT', I imagine that it hasn't changed from Win95.  I don't have a Win95 machine up and running to compare for sure though.

As for the Context Menu entries, perhaps they go in the same key?
0
 
LVL 1

Author Comment

by:twh270
ID: 1406473
Thanks for the reply.  That is a good answer, but I'm going to
have to reject it as it doesn't tell me anything I don't already
know.  Property sheets are "trivial" compared to the context
menu, apparently.  I have plenty of sample code that shows how
to do property sheets (and plenty of context menu sample code
too, actually - but none that shows how to subclass the desktop
menu.)  IIRC, your key is correct for the Display properties
sheet.  Just for kicks, I will try putting the context menu
shellex in the same key, but I would be very surprised to find
it worked.  If it does, you will get full credit for the answer;
if noone else is able to answer my question I will give you
partial credit.
0
 
LVL 3

Accepted Solution

by:
vinniew earned 120 total points
ID: 1406474
There is a sample called "power tools" on the MS web site.  The DOSHere piece has exactly what you want.  I don't have the install local anymore or i'd give it to you.  DOSHere is a .inf and .reg file combination that lets you start a command.com from a directory in the explorer, using a right click.

V

0
 
LVL 1

Author Comment

by:twh270
ID: 1406475
I can't find this on Microsoft's web site.  Can you tell me
where it is?

0
 

Expert Comment

by:mattyg102096
ID: 1406476
I found the DOSHere piece at TuCows.  I don't think this is what you want.

1.  It adds a simple command option to the Context Menu.  i.e.  It uses the Shell\...\command.  This is like the entry for the Open, Edit, or Print options that appear on the menu.  In this case it adds a command that invokes COMMAND.COM with a specific set of command arguments that change the current directory to the location you invoked the menu for.

2.  This example adds the commands to the context menus for all drives and directories by adding the appropriate shell keys to HKEY_CLASSES_ROOT\Drive and HKEY_CLASSES_ROOT\Directory respectively.  This tells you nothing about adding to the context menu of the Desktop.  In the off chance that it did (i.e. the system treats the desktop like a directory, which in a way I suppose it is), it would not be limited to adding the item to the desktop menu... it would be added to all the menus for Drives and Directories.  Would this be appropriate?

In short, the point I was trying to make before was that I think you are on the right track.  From what I can tell at a glance,you are doing things right as far as WHAT you NEED to be adding... I just don't think that you're adding the keys in the right place.  The question here is "which registry key controls the desktop"... not "what do I put there"?
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
link access with Quickbooks 9 49
Insert filename column as column a 18 76
Windows Installer 4 72
Access 2013: API code to put hidden database icon in taskbar? 8 78
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question