internal static string GetWindowText(IntPtr hWnd) { try { int length = DllUser32.GetWindowTextLength(hWnd); var sb = new StringBuilder(length + 1); DllUser32.GetWindowText(hWnd, sb, sb.Capacity); return(sb.ToString()); } catch (Exception) { return("err-get-TxtWin"); } }