i have already asked a few questions about this (please look above), so
to cut a long story short, I am asking for DETAILED explenation of how
to make the examples in Demos\Activex\ShellExt\ work.
P L E A S E, don't tell me to add entries in the registry for unique use
like executing application.
I don't succeed in implementing a context menu handler interface.
do you ask why ? so:
I know that the system should pass the object's context menu to the
handelers that specified in the registry. i also know that the shell
call to the invokecommad function of the handler in order to let it
implement something (after the user clicks inserted item). and i also
know the the system use those 4 function that exported by the .Dll.
i think my problem is that i don't know anything about interfaces/COM.
i think the system looks for the HANDLER that include this unique GUID
{EBDF1F20-C829-11D1-8233-0020AF3E97A9} but doesn't find it.
what should i do in order to make the system find MY handler?
the delphi examples in this directory are .Dll projects. what should i
do with the dll??
does the system should know about this contmenu.dll somehow, and load
it?
should i write another application that load the dll?? and than what??
thanks (again) in advance.
You're using Delphi not VC++ <g>
Okay : How to start the examples :
( menu title may differ a little bit , i'm using german localized version )
a)Set Output Directory to : C:\Winnt\system32\ShellExt ( or where ver your Nt
resides )
b)Select Explorer.Exe as Host Application
c)Compile your app
d)Select Register ActiveX Server from Menu Start
e)Select Run and select a *.dpr in explorer
if it doesn't work first time kill the regular explorer with Task Manager and
start it again
If you look in the source of this example
there is an overwritten factory for this Handler with this key method
procedure TContextMenuFactory.UpdateRegistry(Register: Boolean);
the ancestor does the "normal" registry stuff, necessary for every Ole Server,
this overwritten one does the extra stuff for shell handlers. Look into, to see,
where it creates this extra entries.
The generated functions in project file call this method when registering and
unregistering. Everything is done for you. BTW RegSvr.Exe does nothing more or
less than a LoadLibrary followed by a GetProcAdress('DllRegisterServer '..) and
a call to this function.
How does the system load this stuff ?
When you hit a file in explorer it looks at the suffix in registry. Is there a
name registered with it ? No, then look here after a subkey
shellex\ContextMenuHandlers. There is a name registered with it ( in case of
*.dpr it's DelphiProject ), okay then look there after this sub key
shellex\ContextMenuHandlers. The subkey holds the CL_SID of your handler, the
shell looks it up ( these are the "normal" entries for a OLE Server ) and finds
the path to your DLL and invokes it. That's all.
Considering your first post about this ( Contexthandler for every file ) there
is an entry "*" in registry where you set handlers for all kinds of files.
If you did a search in registry for string WinZip you would have found it really
fast.
The place where you decide wether you want to show an item in the menu or not,
is
function <THandlerClass>.ShellInitialize(pidlFolder: PItemIDList; lpdobj:
IDataObject;
hKeyProgID: HKEY): HResult;
Be prepared to fight with IDataObject, TStgMedium, TFormatEtc and DragQueryFile.
<THandlerClass>.QueryContextMenu is too late. Implement as fast as you can !
It's called for every file selected in explorer if registered for *.
HTH
Bernd
Just one last tip : if you're debugging, don't wonder if it takes some time till
explorer releases the dll. That's normal. The Explorer does some caching on this
Inprocess Servers and releases it a few seconds later.
--
Bernd Ua - Software-Haus Brumund GmbH
u...@nospambrumund.de
// to reply, remove nospam from email adress :-)
// obviously this needs to be stated, too : please no unsolicited private email
unless explicitly invited