Groups | Blog | Home
all groups > dotnet interop > october 2004 >

dotnet interop : Explorer Context Menu / IcontextMenu2 Interface


Jeff Gaines
10/6/2004 11:09:34 AM

I am working on a file manager type app (in C#) that use the
API/Interop quite extensively.

I am managing to get Explorer's context menu to appear and all of the
items show up properly (and work) except the 'Open With' item.

I am trapping the appropriate messages in my WndProc as follows:

case (int)wm.WM_DRAWITEM:
case (int)wm.WM_MEASUREITEM:
case (int)wm.WM_INITMENUPOPUP:
if(m_IContextMenu2 != null)
m_IContextMenu2.HandleMenuMsg((uint)message.Msg, (uint)
message.WParam, (uint)message.LParam);

The 'Send To' menu item shows properly with its icons so it seems the
IContextMenu2 interface part is working.

The 'Open With' menu shows as a menu separator with just a glimpse of
part of an icon above it then under it the 'Choose Program...' item
shows - and works.

It is as if the items above the separator are not being drawn, or
perhaps all being drawn on top of each other.

I am a bit at a loss as to how to proceed, debugging into the
procedures is OK but the context menu won't show because I am in the
IDE at the critical time.

Can anybody give me any suggestions as to where to look, or is this a
known issues? Anybody know if there's any sample code anywhere that may
help? All the Explorer examples I have seen either don't implement the
context menu or don't implement IContextMenu2. Even the commercial
replacement Explorers/File Managers I have tried out seem to have
problems in this area which makes me wonder if it's actually possible.

Any suggestions would be much appreciated.

--
Mattias Sjögren
10/6/2004 9:53:34 PM
Jeff,

Have you tried using IContextMenu3 if supported? I believe it's better
to first try IContextMenu3, then fall back on IContextMenu2 when
necessary.

You can probably get more details in
microsoft.public.platformsdk.shell.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Jeff Gaines
10/7/2004 3:45:00 AM
[quoted text, click to view]

Hello Mattias

Nice to hear from you again :-)

I have now implemented IContextMenu3 and it works to the same extent as
previously so I'll try the other group as you suggested.

I keep checking Amazon to see if you have written a book yet but
nothing so far!

--
Jeff Gaines
10/7/2004 8:53:15 AM
[quoted text, click to view]

I seem to have found the issue :-)

I was calling base.WndProc after I did my bits. If I call it first then
it works fine, must need to set things up before I intercept it.


--
Mattias Sjögren
10/16/2004 9:03:16 PM
Jeff,

[quoted text, click to view]

Ditto!


[quoted text, click to view]

I'm glad you got it working eventually.


[quoted text, click to view]

Hehe, no time for that. I hardly have time for newsgroups anymore
(sorry for the late reply).



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button