Skip to content

Commit aa5ca76

Browse files
committed
Check window is InternetExplorer type
1 parent 1109f98 commit aa5ca76

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,19 @@ private static string GetActiveExplorerPath()
731731
ShellWindows shellWindows = new SHDocVw.ShellWindows();
732732

733733
// loop through all windows
734-
foreach (SHDocVw.InternetExplorer window in shellWindows)
734+
foreach (var window in shellWindows)
735735
{
736+
if (window is not SHDocVw.InternetExplorer)
737+
{
738+
continue;
739+
}
740+
741+
var explorerWindow = (SHDocVw.InternetExplorer)window;
736742
// match active window
737-
if (window.HWND == (int)handle)
743+
if (explorerWindow.HWND == (int)handle)
738744
{
739745
// Required ref: Shell32 - C:\Windows\system32\Shell32.dll
740-
var shellWindow = window.Document as Shell32.IShellFolderViewDual2;
746+
var shellWindow = explorerWindow.Document as Shell32.IShellFolderViewDual2;
741747

742748
// will be null if you are in Internet Explorer for example
743749
if (shellWindow != null)

0 commit comments

Comments
 (0)