/// <summary> /// Gets control name. /// Returns null if fails or the name is empty. /// </summary> /// <param name="c">The control. Can be a top-level window too. Must be of the same process as the window specified in the constructor.</param> public string GetControlName(wnd c) { if (_pm == null) { return(null); } if (!IsWinformsControl(c)) { return(null); } if (!c.SendTimeout(5000, out var R, WM_GETCONTROLNAME, 4096, _pm.Mem) || (int)R < 1) { return(null); } int len = (int)R - 1; if (len == 0) { return(""); } return(_pm.ReadCharString(len)); }