Skip to content

Commit 922cbbe

Browse files
committed
Add GetCommandStringFlags
1 parent 850df70 commit 922cbbe

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Helper/ShellContextMenuDisplayHelper.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,20 @@ enum MenuItemFtype : uint
146146
String = 0x00000000,
147147
}
148148

149+
enum GetCommandStringFlags : uint
150+
{
151+
VerbA = 0x00000000,
152+
HelpTextA = 0x00000001,
153+
ValidateA = 0x00000002,
154+
Unicode = VerbW,
155+
Verb = VerbW,
156+
VerbW = 0x00000004,
157+
HelpText = HelpTextW,
158+
HelpTextW = 0x00000005,
159+
Validate = ValidateW,
160+
ValidateW = 0x00000006,
161+
VerbIconW = 0x00000014
162+
149163
#endregion
150164

151165
private static IMalloc GetMalloc()
@@ -185,7 +199,7 @@ public static void ExecuteContextMenuItem(string fileName, uint menuItemId)
185199
contextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(pContextMenu, typeof(IContextMenu));
186200

187201
hMenu = CreatePopupMenu();
188-
contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Normal);
202+
contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Explore);
189203

190204
var directory = Path.GetDirectoryName(fileName);
191205
var invokeCommandInfo = new CMINVOKECOMMANDINFO
@@ -195,7 +209,7 @@ public static void ExecuteContextMenuItem(string fileName, uint menuItemId)
195209
hwnd = IntPtr.Zero,
196210
lpVerb = (IntPtr)(menuItemId - ContextMenuStartId),
197211
lpParameters = null,
198-
lpDirectory = directory ?? "",
212+
lpDirectory = null,
199213
nShow = 1,
200214
hIcon = IntPtr.Zero,
201215
};
@@ -236,10 +250,10 @@ public static List<ContextMenuItem> GetContextMenuWithIcons(string filePath)
236250
IMalloc malloc = null;
237251
IntPtr originalPidl = IntPtr.Zero;
238252
IntPtr pShellFolder = IntPtr.Zero;
239-
IShellFolder shellFolder = null;
240253
IntPtr pContextMenu = IntPtr.Zero;
241-
IContextMenu contextMenu = null;
242254
IntPtr hMenu = IntPtr.Zero;
255+
IShellFolder shellFolder = null;
256+
IContextMenu contextMenu = null;
243257

244258
try
245259
{
@@ -262,7 +276,7 @@ public static List<ContextMenuItem> GetContextMenuWithIcons(string filePath)
262276
contextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(pContextMenu, typeof(IContextMenu));
263277

264278
hMenu = CreatePopupMenu();
265-
contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Normal);
279+
contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Explore);
266280

267281
var menuItems = new List<ContextMenuItem>();
268282
ProcessMenuWithIcons(hMenu, contextMenu, menuItems);

0 commit comments

Comments
 (0)