Example #1
0
        internal static string GetWindowTitle(IntPtr hWnd)
        {
            int           length        = User32Methods.GetWindowTextLength(hWnd);
            StringBuilder stringBuilder = new StringBuilder(length + 1);

            User32Methods.GetWindowText(hWnd, stringBuilder, stringBuilder.Capacity);
            return(stringBuilder.ToString());
        }
Example #2
0
        public string GetText()
        {
            var size = User32Methods.GetWindowTextLength(this.Handle);

            if (size > 0)
            {
                var sb = new StringBuilder(size);
                return(User32Methods.GetWindowText(this.Handle, sb, size) > 0 ? sb.ToString() : string.Empty);
            }
            return(string.Empty);
        }