This project is read-only.

How does CanShowMenu() work?

Aug 21, 2013 at 9:32 PM
I pretty much have an context menu app built with SharpShell. The problem is CanShowMenu() does not seem seem to be getting called from the base class. Currently I changed to to return 'false' in all cases:

protected override bool CanShowMenu()
return false;

but it still shows the context menu. Any suggestions? Am I missing something?

Thank you for a great product!

Aug 22, 2013 at 3:33 PM

That's strange - what have you got as the ComServerAssociations?
Aug 22, 2013 at 4:50 PM
Edited Aug 22, 2013 at 9:17 PM
[COMServerAssociation(AssociationType.ClassOfExtension, ".dgn", ".cel", ".dwg")]

Sep 11, 2013 at 7:28 PM
Can you try downloading the latest source code and seeing if it works with that? I've been running regression tests and it seems to be fine currently. If so, I'll close this discussion with the release of 2.0
Dec 24, 2013 at 2:45 AM

i had the same problem and fixed it in SharpContextMenu.cs function QueryContextMenu in the try - Block...
                ToolStripItemCollection itemsToShow = new ToolStripItemCollection(new ToolStrip(), new ToolStripItem[]{});
                foreach(ToolStripItem item in contextMenuStrip.Value.Items) // check every single item...
                    if(this.CanShowMenu(item)) //<--- this needs an interface (of abstract class) change! -> 
                                                            // I didn't handed the item in, but it would make more sense with it
                        itemsToShow.Add(item); // the item to show in context menu

                lastItemId = nativeContextMenuWrapper.BuildNativeContextMenu(hMenu, firstItemId,
it is not a perfect solution, but it solved my problem... btw.: cool project and good job!

regards, Daniel
Dec 30, 2013 at 2:47 PM
Looks great Daniel - thanks for taking the time to comment, I'll see if I can get this into the next release! See:

for progress