?
Solved

Adding shell extensions to registry

Posted on 1997-09-10
5
Medium Priority
?
1,183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 240 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

764 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