Skip to content

Commit 2e2c174

Browse files
committed
Native context menu: wait before querying the menu
1 parent 58e4285 commit 2e2c174

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Runtime.InteropServices;
66
using System.Text;
7+
using System.Threading;
78
using System.Windows;
89
using System.Windows.Interop;
910
using System.Windows.Media;
@@ -275,6 +276,10 @@ public static List<ContextMenuItem> GetContextMenuWithIcons(string filePath)
275276

276277
contextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(pContextMenu, typeof(IContextMenu));
277278

279+
// Without waiting, some items, such as "Send to > Documents", don't always appear, which shifts item ids
280+
// even though it shouldn't. Please replace this if you find a better way to fix this bug.
281+
Thread.Sleep(200);
282+
278283
hMenu = CreatePopupMenu();
279284
contextMenu.QueryContextMenu(hMenu, 0, ContextMenuStartId, ContextMenuEndId, (uint)ContextMenuFlags.Explore);
280285

0 commit comments

Comments
 (0)