From 922cbbe92c60c61576231da4afc126b0b05ed9fd Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Wed, 12 Jun 2024 17:14:16 +0600 Subject: [PATCH] Add GetCommandStringFlags --- .../Helper/ShellContextMenuDisplayHelper.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/ShellContextMenuDisplayHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/ShellContextMenuDisplayHelper.cs index 6becb7793..c1cd1d6ba 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/ShellContextMenuDisplayHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/ShellContextMenuDisplayHelper.cs @@ -146,6 +146,20 @@ public static class ShellContextMenuDisplayHelper String = 0x00000000, } + enum GetCommandStringFlags : uint + { + VerbA = 0x00000000, + HelpTextA = 0x00000001, + ValidateA = 0x00000002, + Unicode = VerbW, + Verb = VerbW, + VerbW = 0x00000004, + HelpText = HelpTextW, + HelpTextW = 0x00000005, + Validate = ValidateW, + ValidateW = 0x00000006, + VerbIconW = 0x00000014 + #endregion private static IMalloc GetMalloc() @@ -185,7 +199,7 @@ public static class ShellContextMenuDisplayHelper contextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(pContextMenu, typeof(IContextMenu)); hMenu = CreatePopupMenu(); - contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Normal); + contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Explore); var directory = Path.GetDirectoryName(fileName); var invokeCommandInfo = new CMINVOKECOMMANDINFO @@ -195,7 +209,7 @@ public static class ShellContextMenuDisplayHelper hwnd = IntPtr.Zero, lpVerb = (IntPtr)(menuItemId - ContextMenuStartId), lpParameters = null, - lpDirectory = directory ?? "", + lpDirectory = null, nShow = 1, hIcon = IntPtr.Zero, }; @@ -236,10 +250,10 @@ public static class ShellContextMenuDisplayHelper IMalloc malloc = null; IntPtr originalPidl = IntPtr.Zero; IntPtr pShellFolder = IntPtr.Zero; - IShellFolder shellFolder = null; IntPtr pContextMenu = IntPtr.Zero; - IContextMenu contextMenu = null; IntPtr hMenu = IntPtr.Zero; + IShellFolder shellFolder = null; + IContextMenu contextMenu = null; try { @@ -262,7 +276,7 @@ public static class ShellContextMenuDisplayHelper contextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(pContextMenu, typeof(IContextMenu)); hMenu = CreatePopupMenu(); - contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Normal); + contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Explore); var menuItems = new List(); ProcessMenuWithIcons(hMenu, contextMenu, menuItems);