Board index » cppbuilder » Adding Items To The Explorer Right Click Menu

Adding Items To The Explorer Right Click Menu

I'm not sure if this is the proper news group to post this too, but i
think that what i want to do involves ActiveX / COM / OLE So i thought
this would be a good place to start. I would like to be able to add an
item to explorer's right click menu to open files with my program, but
when it's running, i would like to change it to open in the current
running copy (it's a single instance program). Any advice, hints, tips,
pointers, etc... are greatly appreciated, as of know i'm clueless.

Note:
    Preferred to do it in delphi 6 PE, but i have access to Builder 4
    Pro, and *sigh* MSVC

Thanks in advance,
   Timothy Slusher

 

Re:Adding Items To The Explorer Right Click Menu


Quote
Tim Slusher wrote:
> I'm not sure if this is the proper news group to post this too, but i

[snip]

Quote

Yes, this is the correct group. I suggest searching it, as this was
discussed in the past and even sample code was posted, IIRC. Also, MSDN
has very good samples of this (I used them to get me started).

hth,
.a

Re:Adding Items To The Explorer Right Click Menu


Quote
"Tim Slusher" <jun...@phuzzy.org> wrote in message

news:3ebbee03$1@newsgroups.borland.com...

Quote
> I'm not sure if this is the proper news group to post
> this too, but i think that what i want to do involves
> ActiveX / COM / OLE

Actually, for basic menu items, all it involves is modifying the Registry.
The only time COM comes into play is if you're wanting to write a context
menu shell extension to give your menu items advanced behaviors.

Quote
> I would like to be able to add an item to explorer's right
> click menu to open files with my program, but when it's
> running, i would like to change it to open in the current
> running copy (it's a single instance program).

All you have to do is configure the appropriate Registry values to add the
menu item and pass the filename to your application. This article tells you
how to set up a simple menu item:

    Extending Shortcut Menus

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/progra...

Or alternative, have a look at my free TRegExtension component,
http://reg.lebeausoftware.org (note, a newly designed version is currently
in the works).

Either way, the thing to keep in mind is that this approach will load a new
instance of your application.  To pass the new filename to your existing
instance, you have two options:

1) have your application's startup code test for an existing instance
(http://www.bcbdev.com/faqs/faq74.htm), and if found then use the
WM_COPYDATA message to send the filename over to the previous instance and
then terminate itself without doing anything else.

2) add a DDE server to your application.  The Registry entries you add for
the menu item can alternatively invoke a DDE session with an existing
instance, and send the relavant data to it directly.  The above article
describe that scenerio as well.

Gambit

Re:Adding Items To The Explorer Right Click Menu


Thank you very much for all your help :)

Re:Adding Items To The Explorer Right Click Menu


I've browsed archive news groups, and couldn't find anything on this (or
didn't look hard enough) but i'm still kind of lost. Any ideas on where
i can find samples for delphi, using IContextMenu?

Other Threads