@@ -722,68 +722,6 @@ private void SetOpenResultModifiers()
722
722
OpenResultCommandModifiers = _settings . OpenResultModifiers ?? DefaultOpenResultModifiers ;
723
723
}
724
724
725
- private static string GetActiveExplorerPath ( )
726
- {
727
- // get the active window
728
- IntPtr handle = GetForegroundWindow ( ) ;
729
-
730
- // Required ref: SHDocVw (Microsoft Internet Controls COM Object) - C:\Windows\system32\ShDocVw.dll
731
- ShellWindows shellWindows = new SHDocVw . ShellWindows ( ) ;
732
-
733
- // loop through all windows
734
- foreach ( var window in shellWindows )
735
- {
736
- if ( window is not SHDocVw . InternetExplorer )
737
- {
738
- continue ;
739
- }
740
-
741
- var explorerWindow = ( SHDocVw . InternetExplorer ) window ;
742
- // match active window
743
- if ( explorerWindow . HWND == ( int ) handle )
744
- {
745
- // Required ref: Shell32 - C:\Windows\system32\Shell32.dll
746
- var shellWindow = explorerWindow . Document as Shell32 . IShellFolderViewDual2 ;
747
-
748
- // will be null if you are in Internet Explorer for example
749
- if ( shellWindow != null )
750
- {
751
- // Item without an index returns the current object
752
- var currentFolder = shellWindow . Folder . Items ( ) . Item ( ) ;
753
-
754
- // special folder - use window title
755
- // for some reason on "Desktop" gives null
756
- if ( currentFolder == null || currentFolder . Path . StartsWith ( "::" ) )
757
- {
758
- // Get window title instead
759
- const int nChars = 256 ;
760
- StringBuilder Buff = new StringBuilder ( nChars ) ;
761
- if ( GetWindowText ( handle , Buff , nChars ) > 0 )
762
- {
763
- return Buff . ToString ( ) ;
764
- }
765
- }
766
- else
767
- {
768
- return currentFolder . Path ;
769
- }
770
- }
771
-
772
- break ;
773
- }
774
- }
775
-
776
- return null ;
777
- }
778
-
779
- // COM Imports
780
-
781
- [ DllImport ( "user32.dll" ) ]
782
- private static extern IntPtr GetForegroundWindow ( ) ;
783
-
784
- [ DllImport ( "user32.dll" ) ]
785
- static extern int GetWindowText ( IntPtr hWnd , StringBuilder text , int count ) ;
786
-
787
725
public void ToggleFlowLauncher ( )
788
726
{
789
727
if ( ! MainWindowVisibilityStatus )
@@ -798,7 +736,7 @@ public void ToggleFlowLauncher()
798
736
799
737
public void Show ( )
800
738
{
801
- string _explorerPath = GetActiveExplorerPath ( ) ;
739
+ string _explorerPath = FileExplorerHelper . GetActiveExplorerPath ( ) ;
802
740
803
741
804
742
if ( _settings . UseSound )
@@ -816,7 +754,7 @@ public void Show()
816
754
( ( MainWindow ) Application . Current . MainWindow ) . WindowAnimator ( ) ;
817
755
818
756
MainWindowOpacity = 1 ;
819
- if ( _explorerPath != null && _explorerPath != "File Explorer" )
757
+ if ( _explorerPath != null )
820
758
{
821
759
ChangeQueryText ( $ "{ _explorerPath } \\ >") ;
822
760
}
0 commit comments