mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Peek]Fix crashes on File Explorer alternatives (#31211)
* [Peek] Add check to ensure window class name matches File Explorer * [Peek] Safe casting for IShellFolderViewDual2 compatibility.
This commit is contained in:
@@ -63,9 +63,10 @@ namespace Peek.UI.Helpers
|
|||||||
|
|
||||||
var shell = new Shell32.Shell();
|
var shell = new Shell32.Shell();
|
||||||
ShellWindows shellWindows = shell.Windows();
|
ShellWindows shellWindows = shell.Windows();
|
||||||
foreach (IWebBrowserApp webBrowserApp in shell.Windows())
|
foreach (IWebBrowserApp webBrowserApp in shellWindows)
|
||||||
|
{
|
||||||
|
if (webBrowserApp.Document is Shell32.IShellFolderViewDual2 shellFolderView)
|
||||||
{
|
{
|
||||||
var shellFolderView = (Shell32.IShellFolderViewDual2)webBrowserApp.Document;
|
|
||||||
var folderTitle = shellFolderView.Folder.Title;
|
var folderTitle = shellFolderView.Folder.Title;
|
||||||
|
|
||||||
if (webBrowserApp.HWND == foregroundWindowHandle)
|
if (webBrowserApp.HWND == foregroundWindowHandle)
|
||||||
@@ -81,6 +82,7 @@ namespace Peek.UI.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return shellItemArray;
|
return shellItemArray;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user