C++ Windows Shell context menu handler (CppShellExtContextMenuHandler)

The code sample illustrates how to create a Windows Shell context menu handler in VC++

C++ (91.1 KB)
4.6 Star
25,157 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Windows 10 and Visual Studio 2019
    1 Posts | Last post Tue 8:42 AM
    • Successfully built and registered, no errors.
      But not working...
      Nothing happened at the context menu. :(
  • Not working on Windows 10
    3 Posts | Last post March 27, 2018
    • Has anyone got this example working on Windows 10? I cant seem to register it after a successful build. I have tried it with VS2010 and VS2015. The error I am getting is:
      The module ... failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files. The specified module could not be found.
      I'm running Win10 64 bit, compiling it as 64 bit and running command prompt as administrator.
    • Okay found that I needed the "Microsoft Visual C++ 2015 Redistributable (x64) 14.X" installed. This fixed my problem. Seems like it was a combination of compiling for Windows 10 in VS2015 and also the redistributable.
    • This worked for me too.  Thanks for following up here!
  • Can't register ...
    1 Posts | Last post July 21, 2015
    • The code sample is just working fine. 
      I created cutomised version of this and it's build is successful. dll is getting generaed but once I try to register dll i'm getting error as below
      The module <dllname.dll> was loaded but the entry-point DLLRegisterServer was not found.
      During the build of customised version the library (***ShellExtContextMenuHandler.lib) and object (***ShellExtContextMenuHandler.exp ) files were not generated which could be the cause for error.
      I am not sure why these files were not created during the build, can someone suggest the reason?
  • I can build and register, but the context item doesn't appear
    2 Posts | Last post July 30, 2013
    • I downloaded the code and I'm currently able to build it in 64 bit (I'm using Windows 7 64bit).
      Dll registration succeeded, however when I right click on a single .cpp file the context item is not present in the menu.
      If I try to unregister the DLL, the operation is successful (and if I try that a second time, it fails) meaning that the registration process works.
      Is there anything I can do to debug this? 
    • I had the same exact problem (register successfully but context menu not showing up). I noticed that it worked on another computer without Visual Studio installed. So I changed the extension that this sample works with from .cpp to an unused extension. Then it started working. I don't have a complete explanation but this might get you on the right track.
  • Windows 8 support
    3 Posts | Last post July 17, 2013
    • The DLL can be registered well in windows 8. But the code doesn't work in windows 8. I guess the problem is in registry (while registering the DLL).
      The value against the GUID in ShellEx->ContextMenuHandlers is NULL.
    • My mistake, the GUID is not null, but it still don't work in windows 8
    • Hi, if in a x64 Windows system, please configure the project to x64. I tested it well on my windows 8 x64.
  • All file types
    2 Posts | Last post May 02, 2013
    • I want the menu to appear for all file types. How could I achieve this?
    • Figured it out. I was using .* instead of * when registering.
  • Disable/Delete menu item
    1 Posts | Last post April 30, 2013
    • Hi,
      This is very nice example. I would like to know, if there is a possibility if we can disable/delete an exiting menu item.
  • Can't register ...
    6 Posts | Last post January 23, 2013
    • This builds ok, but regsvr32 says 'LoadLibrary("CppShellExtContextMenuHandler.dll") failed - procedure not found' (I hope this translation is accurate - I'm running a german os).
      This is on Windows XP Professional SP3.
      Any ideas anyone?
    • Are you doing the regsvr32 cmd from the bin folder of the project? It seems like the message that occurs when the file is inexistent.
    • The problem with "procedure not found" occurs because RegDeleteTreeW is not found in advapi32.dll on Windows XP SP3. By replacing RegDeleteTree() in Reg.cpp by SHDeleteKey() (2 times) the problem can be resolved. SHDeleteKey() is defined in Shlwapi.dll (use #include <Shlwapi.h>).
      I found this out by creating another program that tried to load CppShellExtContextMenuHandler.dll, which had more accurate error handling by calling FormatMessage(..., GetLastError, ...).
    • Thanks for your reply, I'll give that a go.
    • Lennert, can you please give a little more information about that method replacement? I've only found the RegDeleteTree on the Unregistring methods, not on the register.
      Thank you
    • Thanks Lennert Ploeger it just worked, and to the sample publisher please patch it and make it aware of XP SP3
  • Windows 8 x64
    2 Posts | Last post October 11, 2012
    • Is there a particular reason why this is not working in W8?
      There are no errors...
    • I had to build it against W8 SDK.
  • Not work in XP
    1 Posts | Last post August 23, 2012
    • LoadLibrary("xxxx.dll") failed. The specified procedure could not be found ..
1 - 10 of 13 Items