Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextMenu related problems #468

Closed
zhuxb711 opened this issue May 28, 2024 · 1 comment
Closed

ContextMenu related problems #468

zhuxb711 opened this issue May 28, 2024 · 1 comment

Comments

@zhuxb711
Copy link

Describe the bug and how to reproduce

  1. InvokeVerb will not work if do not enum the ContextMenu of a ShellItem
  2. Throw exception at here if failure using .ThrowIfFailed()
    ComInterface.InvokeCommand(invoke);

What code is involved

For problem 1:

Work:

ShellContextMenu ContextMenu = new ShellItem("<File path>").ContextMenu;

if (ContextMenu.GetItems(Shell32.CMF.CMF_DEFAULTONLY).FirstOrDefault((Item) => string.Equals(Item.Verb, "open", StringComparison.OrdinalIgnoreCase)) is ShellContextMenu.MenuItemInfo Info)
{
    ContextMenu.InvokeVerb(Info.Verb);
}

Not work:

ShellFile.ShellCoreItem.ContextMenu.InvokeVerb("open");

Expected behavior

  1. InvokeVerb() should work at both situation
  2. InvokeVerb() should throw exception rather than failed silently.
dahall added a commit that referenced this issue May 28, 2024
…QueryContextMenu had not been called (#468). Thanks to @shuxb711 for the workaround.
@dahall
Copy link
Owner

dahall commented May 28, 2024

Fixed in upcoming 4.0.2. Thanks for hint.

@dahall dahall closed this as completed May 28, 2024
@dahall dahall reopened this May 29, 2024
@dahall dahall closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants