bool _FillProperties(bool newWindow) { bool isCon = !_con.Is0; _WinInfo f = default; if (!_GetClassName(_wnd, out f.wClass)) { return(false); //note: get even if !newWindow, to detect closed window } if (isCon && !_GetClassName(_con, out f.cClass)) { return(false); } bool _GetClassName(wnd w, out string cn) { cn = w.ClassName; if (cn != null) { return(true); } _winInfo.zText = "Failed to get " + (w == _wnd ? "window" : "control") + " properties: \r\n" + lastError.message; _scroller.Visibility = Visibility.Hidden; return(false); } _noeventValueChanged = true; var wndName = _wnd.NameTL_; if (newWindow) { nameW.Set(true, TUtil.EscapeWindowName(wndName, true)); classW.Set(true, TUtil.StripWndClassName(f.wClass, true)); f.wProg = _wnd.ProgramName; var ap = new List <string> { f.wProg, "WOwner.Process(processId)", "WOwner.Thread(threadId)" }; if (!_wnd.Get.Owner.Is0) { ap.Add("WOwner.Window(ow)"); } programW.Set(wndName.NE(), f.wProg, ap); containsW.Set(false, null, _ContainsCombo_DropDown); } else if (wndName != _wndName) { if (TUtil.ShouldChangeTextBoxWildex(nameW.t.Text, wndName)) { nameW.Set(true, TUtil.EscapeWindowName(wndName, true)); } } f.wName = _wndName = wndName; if (isCon) { //name combo f.cName = _con.Name; int iSel = f.cName.NE() ? -1 : 0; var an = new List <string> { TUtil.EscapeWildex(f.cName) }; _ConNameAdd("***wfName ", f.cWF = _con.NameWinforms); /*bool isElm =*/ _ConNameAdd("***elmName ", f.cElm = _con.NameElm); //bool isLabel = _ConNameAdd("***label ", f.cLabel = _con.NameLabel); //if(isElm && isLabel && iSel == an.Count - 2 && f.cElm == f.cLabel) iSel++; //if label == elmName, prefer label if (iSel < 0) { iSel = 0; //never select text, even if all others unavailable } _ConNameAdd("***text ", f.cText = _con.ControlText); bool _ConNameAdd(string prefix, string value) { if (value.NE()) { return(false); } if (iSel < 0) { iSel = an.Count; } an.Add(prefix + TUtil.EscapeWildex(value)); return(true); } bool idUseful = TUtil.GetUsefulControlId(_con, _wnd, out f.cId); //idC.Visible = idUseful; idC.Set(idUseful, f.cId.ToS() + (idUseful ? null : " /*probably not useful*/")); string sName = an[iSel], sClass = TUtil.StripWndClassName(f.cClass, true); nameC.Set(!idUseful, sName, an); classC.Set(!idUseful, sClass); bool hiddenToo = !_con.IsVisible; cHiddenTooC.IsChecked = hiddenToo; var skip = idUseful ? null : TUtil.GetControlSkip(_wnd, _con, sName, sClass, hiddenToo); skipC.Set(skip != null, skip); } bool checkControl = isCon && _checkControl; _cControl.IsChecked = checkControl; _ShowControlProperties(showGrid: checkControl, showAll: isCon); _noeventValueChanged = false; _scroller.Visibility = Visibility.Visible; _FillWindowInfo(f); return(true); List <string> _ContainsCombo_DropDown() { try { var a1 = new List <string>(); //child foreach (var c in _wnd.Get.Children(onlyVisible: true)) { var cn = c.Name; if (cn.NE()) { continue; } cn = "c '" + TUtil.StripWndClassName(c.ClassName, true) + "' " + TUtil.EscapeWildex(cn); if (!a1.Contains(cn)) { a1.Add(cn); } } //elm var a2 = new List <string>(); var a3 = _wnd.Elm[name : "?*", prop : "notin=SCROLLBAR\0maxcc=100", flags : EFFlags.ClientArea].FindAll(); //all that have a name string prevName = null; for (int i = a3.Length; --i >= 0;) { if (!a3[i].GetProperties("Rn", out var prop)) { continue; } if (prop.Name == prevName && prop.Role == "WINDOW") { continue; } prevName = prop.Name; //skip parent WINDOW string rn = "e '" + prop.Role + "' " + TUtil.EscapeWildex(prop.Name); if (!a2.Contains(rn)) { a2.Add(rn); } } a2.Reverse(); a1.AddRange(a2); return(a1); //rejected: sort } catch (Exception ex) { Debug_.Print(ex); return(null); } } }