獲取窗體中的“是”按鈕

 

 IntPtr p = new IntPtr(0);
            string[] alertName = new string[] { "安全警報", "安全警告", "Security alert" };
            try
            {
                foreach (string item in alertName)
                {
                    p = FindWindow(null, item);
                    if (p == null || p.ToInt32() == 0)
                        continue;
                    IntPtr btn = new IntPtr(0);
                    btn = FindWindowEx(p, btn, "Button", "是(&Y)");
                    if (btn != null && btn.ToInt32() != 0)
                    {
                        SendMessage(btn.ToInt32(), WM_CLICK, 0, 0);
                    }

                }
            }
            catch
            {

            }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章