// Static Create method called by the event tracker system internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild) { if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL) { ProxySimple wtv = new FormsLink(hwnd, null, idChild); wtv.DispatchEvents(eventId, idProp, idObject, idChild); } }
private static IRawElementProviderSimple Create(IntPtr hwnd, int idChild) { // This proxy should not be created with idChild != 0, // unless it is a link label. if (idChild != 0 && !IsLinkLabel(hwnd)) { System.Diagnostics.Debug.Assert(idChild == 0, "Invalid Child Id, idChild != 0"); throw new ArgumentOutOfRangeException("idChild", idChild, SR.Get(SRID.ShouldBeZero)); } StaticType type; int style; try { string className = Misc.GetClassName(hwnd).ToLower(System.Globalization.CultureInfo.InvariantCulture); // Both labels and linklabels have "STATIC" class names if (WindowsFormsHelper.IsWindowsFormsControl(className)) { if (IsLinkLabel(hwnd)) { // Use a different proxy for LinkLabel. return(FormsLink.Create(hwnd, 0)); } } else { // if it's not a Windows Forms control, we didn't want substring matching if (className != "static") { return(null); } } style = Misc.GetWindowStyle(hwnd) & NativeMethods.SS_TYPEMASK; type = GetStaticTypeFromStyle(style); if (type == StaticType.Unsupported) { return(null); } } catch (ElementNotAvailableException) { return(null); } return(new WindowsStatic(hwnd, null, type, style)); }