怎么处理?
我做了一个东西,可是他不仅仅会处理webbrowser1 中页面的弹出对话框,也处理了,其他打开页面的弹出对话框。非常郁闷,请高人帮助。我是开了一个定时器去读的
private void timer1_Tick(object sender, EventArgs e)
{ IntPtr ptrDialogWindow = FindWindow(null, "Microsoft Internet Explorer");
ArrayList clsChildHandles = GetChildWindowHandles(ptrDialogWindow); if (clsChildHandles.Count > 0)
{
if (clsChildHandles.Count == 4)
SendMessage(ptrDialogWindow.ToInt32(), WM_COMMAND, 1, 0);
else
{
string str = GetWindowText(((IntPtr)clsChildHandles[clsChildHandles.Count - 1]).ToInt32());
txtAll.Text = txtAll.Text + DateTime.Now.ToString() + " " + str + "\r\n"; Common.InsertInfo(DateTime.Now.ToString() + " " + str + "\r\n"); SendMessage(ptrDialogWindow.ToInt32(), WM_CLOSE, 0, 0); if (str.Contains("nihao"))
{
groupBox1.Enabled = true;
tmrSelectTel.Enabled = false;
timer1.Enabled = false;
}
} } }
我做了一个东西,可是他不仅仅会处理webbrowser1 中页面的弹出对话框,也处理了,其他打开页面的弹出对话框。非常郁闷,请高人帮助。我是开了一个定时器去读的
private void timer1_Tick(object sender, EventArgs e)
{ IntPtr ptrDialogWindow = FindWindow(null, "Microsoft Internet Explorer");
ArrayList clsChildHandles = GetChildWindowHandles(ptrDialogWindow); if (clsChildHandles.Count > 0)
{
if (clsChildHandles.Count == 4)
SendMessage(ptrDialogWindow.ToInt32(), WM_COMMAND, 1, 0);
else
{
string str = GetWindowText(((IntPtr)clsChildHandles[clsChildHandles.Count - 1]).ToInt32());
txtAll.Text = txtAll.Text + DateTime.Now.ToString() + " " + str + "\r\n"; Common.InsertInfo(DateTime.Now.ToString() + " " + str + "\r\n"); SendMessage(ptrDialogWindow.ToInt32(), WM_CLOSE, 0, 0); if (str.Contains("nihao"))
{
groupBox1.Enabled = true;
tmrSelectTel.Enabled = false;
timer1.Enabled = false;
}
} } }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货