public ExplorerWindow GetExplorerWindow(IntPtr handle) { var windows = GetExplorerWindows((web, list) => { if (web.HWND == handle.ToInt32() && web.LocationURL != "") { list.Add(new ExplorerWindow() { Path = new Uri(web.LocationURL).LocalPath, Name = FolderInfo.GetName(new Uri(web.LocationURL).LocalPath), }); return(true); } return(false); }); if (windows.Any()) { return(windows[0]); } else { return(null); } }
public List <ExplorerWindow> GetExplorerWindows() { var fullName = ExplorerWindow.ExplorerFullName(); return(GetExplorerWindows((web, list) => { if (web.FullName.ToUpper() == fullName && web.LocationURL != "") { list.Add(new ExplorerWindow() { Path = new Uri(web.LocationURL).LocalPath, Name = FolderInfo.GetName(new Uri(web.LocationURL).LocalPath), }); } return false; })); }