コード例 #1
0
        /// <summary>
        /// 尚未成功
        /// </summary>
        static void GetText()
        {
            var bar    = WinApi.FindWindow(null, "Form1Text");
            var btnBar = WinApi.FindWindowEx(bar, IntPtr.Zero, null, "button1");
            var txtBar = WinApi.FindWindowEx(bar, btnBar, null, null);

            StringBuilder sb = new StringBuilder();

            WinApi.GetDlgItemText(bar, (int)txtBar, sb, 255);
            Console.WriteLine(sb.ToString());

            WinApi.GetWindowText(txtBar, sb, 255);//获取标题
            Console.WriteLine(sb.ToString());
        }