views:

119

answers:

3

I would like to create menu item in windows explorer content menu (for all file types) which after click will open my application and pass the selected file name to it. Is there any tutorial for this ? I know there is ShellPlus component available but it's a bit outdated.

A: 

This is possible independendly from the programming language by setting up shortcut menu handlers for the desired filetype(s) in the registry. There you can call your application with the correct path, the correct options and the right file-placeholders.

See the MSDN article on Creating Shortcut Menu Handlers for more detailled information.

Kosi2801
+4  A: 

Registry

This method is easy since it comes down to adding some registry keys. The downside is that you can't put any logic in it. You can read about it here and here a simple example in Delphi. You get a bit more control if you are using DDE to execute the menu items. See here for a Delphi example.

Shell Extension

This method is a bit more work, but you can completely control the context menu from code. You would have to write a DLL, implement IContextMenu (or others) and register the dll with Windows Explorer. You can read about it here. You already mentioned Shell+.

Lars Truijens
+1 for suggesting Shell Extension but please do note that since we cannot create x64 DLL's (yet) in Delphi it will only work for x86 explorer and x86 apps that support Shell Extensions (on both x86 and x64 windows).
Remko
+1  A: 

Delphi includes a demo project for shell extensions. Look in the Demos\ActiveX\ShellExt folder.

Rob Kennedy