views:

114

answers:

3

I need to add an item to folders right click menu when clicked send folder address to my app. how can i do it? it'll be a great help if you describe how to make popup menu for that item and how can i use images for items? something like WinRAR.... and what about file types? same ways? thank you.

+4  A: 

What you want to do is create a Shell Extension. A starting point is this article: Delphi: Windows Shell Extensions. Essentially you need to create a COM component that implements IContextMenu, IContextMenu2 or IContextMenu3 and expose it to Explorer by registering it appropriately.

There's an example at delphi3000.com, but it's only available via the google cache at present.

Rob
In case the OP is unaware, if the target OS is 64-bit versions of Windows, Delphi only produces 32-bit binaries which won't work.
Alan Clark
@Alan Clark, good point, +1 to your comment from me =)
Rob
is there any component or some easier way to do that? i googled but nothing found
Armin
@Armin, not that a cursory search uncovered. Writing Explorer add-ins is quite a specialised task so you'll probably have to take the hit and write it yourself
Rob
+2  A: 

To add new options to the right-click context menu, you'll need to set it up as a shell extension and register it with Windows. Here's an article describing the basic principles for it.

As for how to register a file type with Windows, you can find a mimimal but well-commented Delphi example here.

Mason Wheeler
is there any component or some easier way to do that? i googled but nothing found
Armin
A: 

Depending on your version of Delphi, you may still be able to use the TurboPower ShellShock components http://sourceforge.net/projects/tpshellshock/ to make your life a bit easier :)

Chee Meng
Thanks. It was a great package. but i couldnt find what i need in any of this package components. can you tell me wich component provide my need?
Armin
Well, it's not directly relevant to answering your question, sorry. Just that the package has lots of good code pertaining to using Shell-related stuff that I thought could make your life easier :-)
Chee Meng