Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create two instances using Shell Instance Objects

36 views
Skip to first unread message

hayate

unread,
Jan 26, 2007, 2:28:45 AM1/26/07
to
Hi all,

After reading the article "Creating Shell Extensions with Shell
Instance Objects" written by Raymond Chen, I use the method to create a
context menu. Here is an example

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\SuperHidden]
@="{537F6DED-62F4-45f9-B832-F0E86BD0F136}"

[HKEY_CLASSES_ROOT\CLSID\{537F6DED-62F4-45f9-B832-F0E86BD0F136}\InProcServer32]
@=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,73,\
68,64,6f,63,76,77,2e,64,6c,6c,00
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{537F6DED-62F4-45f9-B832-F0E86BD0F136}\Instance]
"CLSID"="{3f454f0e-42ae-4d7c-8ea3-328250d6e272}"

[HKEY_CLASSES_ROOT\CLSID\{537F6DED-62F4-45f9-B832-F0E86BD0F136}\Instance\InitPropertyBag]
"method"="ShellExecute"
"Param1"="D:\\Program Files\\SuperHidden\\SuperHidden.vbs"
"command"="Display/Hidden Files"
"CLSID"="{13709620-C279-11CE-A49E-444553540000}"

It works well. But now I need an other menu for other task, I found it
cannot display two menus if I add similar keys to the registry.

Is it possible to create 2 instance of object or display mutiple menus
in one instance.

Thx

David Lowndes

unread,
Jan 26, 2007, 2:56:02 AM1/26/07
to
>After reading the article "Creating Shell Extensions with Shell
>Instance Objects" written by Raymond Chen, I use the method to create a
>context menu.
>...

>It works well. But now I need an other menu for other task, I found it
>cannot display two menus if I add similar keys to the registry.
>
>Is it possible to create 2 instance of object or display mutiple menus
>in one instance.

From the single instance you can add many menu items. There's no need
to add further registry settings, just modify the code in your
QueryContextMenu function to insert additional menu items.

Dave

hayate

unread,
Jan 26, 2007, 3:04:02 AM1/26/07
to
Oh sorry
U misunderstanded me. I didn't create a shell extension of COM server,
I just created some reg keys. you can see this article
http://msdn2.microsoft.com/en-us/library/ms997573.aspx for reference.
Or U can import my registry file the above and see the result.

On Jan 26, 3:56 pm, David Lowndes <Dav...@example.invalid> wrote:
> >After reading the article "Creating Shell Extensions with Shell
> >Instance Objects" written by Raymond Chen, I use the method to create a
> >context menu.
> >...
> >It works well. But now I need an other menu for other task, I found it
> >cannot display two menus if I add similar keys to the registry.
>
> >Is it possible to create 2 instance of object or display mutiple menus

> >in one instance.From the single instance you can add many menu items. There's no need

David Lowndes

unread,
Jan 26, 2007, 4:20:36 AM1/26/07
to
>Oh sorry
>U misunderstanded me. I didn't create a shell extension of COM server,
>I just created some reg keys. you can see this article
>http://msdn2.microsoft.com/en-us/library/ms997573.aspx for reference.
>Or U can import my registry file the above and see the result.

Ah my mistake, I wasn't even aware of those.

Dave

Jim Barry

unread,
Jan 26, 2007, 8:40:43 AM1/26/07
to
hayate wrote:
> After reading the article "Creating Shell Extensions with Shell
> Instance Objects" written by Raymond Chen, I use the method to create
> a context menu. Here is an example
[...]

> It works well. But now I need an other menu for other task, I found it
> cannot display two menus if I add similar keys to the registry.

The problem is that the Automation context menu object uses the "open" verb for its menu item. The shell automatically removes menu items with duplicate verbs, which is why your second instance object doesn't appear. And if the "open" verb had already existed in the Directory\Background menu, your first instance object wouldn't have showed up either.

--
Jim Barry, MVP (Windows SDK)

hayate

unread,
Jan 26, 2007, 9:29:40 AM1/26/07
to
Thx very much

Is there a way to change the verb the object use?

I searched the whole internet and couldn't find anything more about
Shell Instance Object except the article of raymond. can U plz tell how
to fetch the detailed info about something like this. Sometimes I need
internal info about some tech and I found nowhere to get it.
For instance, the value here such as "ShellExecute" "Command" "Param1",
How to get the names of these values and the usage?

Jim Barry

unread,
Jan 26, 2007, 11:12:26 AM1/26/07
to
hayate wrote:
> Is there a way to change the verb the object use?

Unfortunately not - it's hard coded.

> I searched the whole internet and couldn't find anything more about
> Shell Instance Object except the article of raymond. can U plz tell
> how to fetch the detailed info about something like this. Sometimes I
> need internal info about some tech and I found nowhere to get it.
> For instance, the value here such as "ShellExecute" "Command"
> "Param1", How to get the names of these values and the usage?

Well, the Automation context menu object isn't documented and presumably is only intended for the shell's internal use. How did you discover it - just by trawling the registry?

hayate

unread,
Jan 26, 2007, 9:56:07 PM1/26/07
to
Thanks all the same

On 1月27日, 上午12时12分, "Jim Barry" <j...@mvps.org> wrote:
> hayate wrote:

> > Is there a way to change the verb the object use?Unfortunately not - it's hard coded.


>
> > I searched the whole internet and couldn't find anything more about
> > Shell Instance Object except the article of raymond. can U plz tell
> > how to fetch the detailed info about something like this. Sometimes I
> > need internal info about some tech and I found nowhere to get it.
> > For instance, the value here such as "ShellExecute" "Command"

> > "Param1", How to get the names of these values and the usage?Well, the Automation context menu object isn't documented and presumably is only intended for the shell's internal use. How did you discover it - just by trawling the registry?

0 new messages