private void RecaptureHandles(IntPtr hwndShellView) { bool fIsSysListView = false; IntPtr hwndListView = WindowUtils.FindChildWindow(hwndShellView, hwnd => { string name = PInvoke.GetClassName(hwnd); if (name == "SysListView32") { fIsSysListView = true; return(true); } else if (!QTUtility.IsXP && name == "DirectUIHWND") { fIsSysListView = false; return(true); } return(false); }); if (CurrentListView != null) { if (CurrentListView.Handle == hwndListView) { return; } PreviousListView = CurrentListView; } if (hwndListView == IntPtr.Zero) { CurrentListView = new AbstractListView(); } else if (fIsSysListView) { CurrentListView = new ExtendedSysListView32(ShellBrowser, hwndShellView, hwndListView, hwndSubDirTipMessageReflect); } else { if (AutoMan == null) { AutoMan = new AutomationManager(); } CurrentListView = new ExtendedItemsView(ShellBrowser, hwndShellView, hwndListView, hwndSubDirTipMessageReflect, AutoMan); } CurrentListView.ListViewDestroyed += ListView_Destroyed; ListViewChanged(this, null); }
public CachedListItemElement(AutomationElement elem, ExtendedItemsView parent) { Point offset = parent.GetWindowPos(); offset = new Point(-offset.X, -offset.Y); Index = elem.GetItemIndex(); Rectangle rect = elem.GetBoundingRect(); rect.Offset(offset); FullRect = rect; bool foundLabel = false; bool foundIcon = false; foreach (AutomationElement child in elem.GetChildren()) { if (!foundLabel && child.GetAutomationId() == "System.ItemNameDisplay") { rect = child.GetBoundingRect(); rect.Offset(offset); LabelRect = rect; if (foundIcon) { break; } foundLabel = true; } else if (!foundIcon && child.GetClassName() == "UIImage") { rect = child.GetBoundingRect(); rect.Offset(offset); IconRect = rect; if (foundLabel) { break; } foundIcon = true; } } }
public CachedListItemElement(AutomationElement elem, ExtendedItemsView parent) { Point offset = parent.GetWindowPos(); offset = new Point(-offset.X, -offset.Y); Index = elem.GetItemIndex(); Rectangle rect = elem.GetBoundingRect(); rect.Offset(offset); FullRect = rect; bool foundLabel = false; bool foundIcon = false; foreach(AutomationElement child in elem.GetChildren()) { if(!foundLabel && child.GetAutomationId() == "System.ItemNameDisplay") { rect = child.GetBoundingRect(); rect.Offset(offset); LabelRect = rect; if(foundIcon) break; foundLabel = true; } else if(!foundIcon && child.GetClassName() == "UIImage") { rect = child.GetBoundingRect(); rect.Offset(offset); IconRect = rect; if(foundLabel) break; foundIcon = true; } } }
private void RecaptureHandles(IntPtr hwndShellView) { bool fIsSysListView = false; IntPtr hwndListView = WindowUtils.FindChildWindow(hwndShellView, hwnd => { string name = PInvoke.GetClassName(hwnd); if(name == "SysListView32") { fIsSysListView = true; return true; } else if(!QTUtility.IsXP && name == "DirectUIHWND") { fIsSysListView = false; return true; } return false; }); if(CurrentListView != null) { if(CurrentListView.Handle == hwndListView) { return; } PreviousListView = CurrentListView; } if(hwndListView == IntPtr.Zero) { CurrentListView = new AbstractListView(); } else if(fIsSysListView) { CurrentListView = new ExtendedSysListView32(ShellBrowser, hwndShellView, hwndListView, hwndSubDirTipMessageReflect); } else { CurrentListView = new ExtendedItemsView(ShellBrowser, hwndShellView, hwndListView, hwndSubDirTipMessageReflect); } CurrentListView.ListViewDestroyed += ListView_Destroyed; ListViewChanged(this, null); }