File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments