Solved

Adding shell extensions to registry

Posted on 1997-09-10
5
1,168 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now