DemoContextMenu
===============

   by Jim White, MathImagical Systems, NSW Australia
   
          email: mathimagics@yahoo.co.uk


1.  Setup

   Before you make any changes to the code, ensure that the
   compiled version of the current version is correctly set
   up.

   First, register the current version of DemoContextMenu.dll 
   (via the "regsrv32" system utility).

   Then create an entry in the registry that will link this
   dll to Explorer as a ContextMenuHandler for the ".exe"
   file class (I'm assuming your "target" file is an exe).
   I've included a "regedit" script file called
   "ContextMenu.reg" which does this for you.

   Once these 2 steps have been completed, you don't have to
   do them again. You can make new versions of the dll, without
   having to re-register.


2. Check that the DLL works

   To demonstrate that the handler can choose whether or not
   to insert options in the Context Menu depending on the
   object that was right-clicked, the DLL I've given you will 
   insert options only if the file clicked starts with a vowel 
   (A,E,I,O or U) 

   Also, the registry script I've given you, when used to update
   the registry, means that this DLL is only invoked if the file 
   clicked has extension ".exe".

   So, to verify that the setup and registration has been done correctly, 
   find (or just create) a file that has extension ".exe",  and that 
   starts with a vowel (e.g. Explorer.exe)

   Using Explorer, Right-click on the file to trigger the context menu.
   
   There should be 3 options visible, the 2nd of which is a submenu.
   
   By passing the mouse over these options, they should identify
   themselves in the Explorer status bar, and when clicked they will
   also display a message box showing the full pathname of the file 
   you clicked.


3. Building a new version of the DLL

   If the demo version works as expected, you can make changes to
   the source code, re-make the DLL, and Explorer will
   automatically use the new version.

   If you get a "permission denied" error when you try to make
   a new version, it's because the current version is still in
   use - try again after closing any Explorer windows that are
   active.

   


4. Customising the Context Menu

   In the "QueryContextMenu" function I've numbered all the
   places you might want to change.

   1. Identifying target file

      This is where you check the filename that was right-clicked
      and decide whether or not to change the menu. If the file
      isn't the one you want, just exit the function att this point.


   2. Inserting a separator

      Just comment out this code if you don't want the menu
      separator line to appear.


   3. Set the Menu caption

      Set your own caption here

      
   4. Bold caption display

      If you don't want the caption displayed with bold font,
      remove/disable this code
   
   
   5. Bitmap display

      If you don't want an image displayed with the caption,
      remove/disable this code.

      If you want to substitute your own image, see below.


   6. Another optional separator

   

5. When the user clicks your menu option

   Explorer will call the cMenu.IContextMenu_InvokeCommand
   procedure, so put your "action" code in there.


6. Changing the image

   If you want to put a different image in your menu option,
   you'll need a 16x16 bitmap. Note - you can't use an icon!
   If you have an icon you want to use you'll need to draw
   it into a PictureBox and use SavePicture to make a
   bitmap.

   Once you've got a bitmap, put it in the RES file, and
   adjust the resource id number, if necessary, in the
   LoadImage statement.


Good luck!
Dr Memory
