Is there any way of calling a DLL that is a shell extension programmatically? We use a software that registers a shell extension on windows explorer, and I need to call one of the items available on its context menu. I do not have the software source code that I want to call.
EDIT
This context menu only appears when I select a PDF file on windows explorer. So i need to call it passing a dll file.
EDIT
Registry information:
[HKEY_CLASSES_ROOT\CLSID{2DC8E5F2-C89C-4730-82C9-19120DEE5B0A}] @="PDFTransformer3.PDFTContextMenu.1"
[HKEY_CLASSES_ROOT\CLSID{2DC8E5F2-C89C-4730-82C9-19120DEE5B0A}\InprocServer32] @="C:\Program Files\ABBYY PDF Transformer 3.0\PDFTContextMenu.dll" "ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\CLSID{2DC8E5F2-C89C-4730-82C9-19120DEE5B0A}\ProgID] @="PDFTransformer3.PDFTContextMenu.1"
[HKEY_CLASSES_ROOT\CLSID{2DC8E5F2-C89C-4730-82C9-19120DEE5B0A}\Programmable]
[HKEY_CLASSES_ROOT\CLSID{2DC8E5F2-C89C-4730-82C9-19120DEE5B0A}\VersionIndependentProgID] @="PDFTransformer3.PDFTContextMenu"
EDIT
Is it possible to call ShellExecuteEx
with the verb i want (not the default one)? If so, how do I call the verb I want (which uses the DLL)?
Thats the verb i wanna call for a PDF file:
The DLL is evidently a context-menu extension. If you want to call it the same way the shell does, then you want to host the IContextMenu interface that the DLL implements. Several years ago, Raymond Chen wrote an extensive series on this topic:
The first two articles are the most important. They introduce how to get the IContextMenu interface of a file in the first place, and then how to invoke one or more of the commands offered by that menu. Essentially, get the IContextMenu interface, fill a CMINVOKECOMMANDINFOEX structure, and then pass it to the interface's InvokeCommand
method. The articles call TrackPopupMenu
to display a menu to the user, and then use the selection to fill the structure, but if you already know exactly which command you want to run, then you can forgo displaying the menu. (You might still have to create the menu, though, since the IContextMenu object probably expects to have QueryContextMenu
called on it first.)
Rafael, you can use the IContextMenu
Interface. from here you can enumerate the entries returned by the interface and then execute the option which you want using the InvokeCommand
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With