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()
731
731
ShellWindows shellWindows = new SHDocVw . ShellWindows ( ) ;
732
732
733
733
// loop through all windows
734
- foreach ( SHDocVw . InternetExplorer window in shellWindows )
734
+ foreach ( var window in shellWindows )
735
735
{
736
+ if ( window is not SHDocVw . InternetExplorer )
737
+ {
738
+ continue ;
739
+ }
740
+
741
+ var explorerWindow = ( SHDocVw . InternetExplorer ) window ;
736
742
// match active window
737
- if ( window . HWND == ( int ) handle )
743
+ if ( explorerWindow . HWND == ( int ) handle )
738
744
{
739
745
// Required ref: Shell32 - C:\Windows\system32\Shell32.dll
740
- var shellWindow = window . Document as Shell32 . IShellFolderViewDual2 ;
746
+ var shellWindow = explorerWindow . Document as Shell32 . IShellFolderViewDual2 ;
741
747
742
748
// will be null if you are in Internet Explorer for example
743
749
if ( shellWindow != null )
You can’t perform that action at this time.
0 commit comments