Skip to content

Commit 0a062c3

Browse files
committed
Fix querying of explorer window
1 parent 5600880 commit 0a062c3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Flow.Launcher/Helper/FileExplorerHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ private static dynamic GetActiveExplorer()
4444

4545
// find the desired window and make sure that it is indeed a file explorer
4646
// we don't want the Internet Explorer or the classic control panel
47-
if (Path.GetFileName((string)window.FullName) == "explorer.exe" && new IntPtr(window.HWND) == handle)
47+
// ToLower() is needed, because Windows can report the path as "C:\\Windows\\Explorer.EXE"
48+
if (Path.GetFileName((string)window.FullName).ToLower() == "explorer.exe" && new IntPtr(window.HWND) == handle)
4849
{
4950
return window;
5051
}
@@ -53,8 +54,6 @@ private static dynamic GetActiveExplorer()
5354
return null;
5455
}
5556

56-
// COM Imports
57-
5857
[DllImport("user32.dll")]
5958
private static extern IntPtr GetForegroundWindow();
6059
}

0 commit comments

Comments
 (0)