winfrom  webBrowser访问某网站,网站弹出提示框,想让程序帮用户点这个提示框

tkucn 2012-03-26 09:45:53
winfrom  webBrowser访问某网站,网站弹出提示框,想让程序帮用户点这个提示框 ,选择“是”


这应该怎么写啊

多谢
...全文
135 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tkucn 2012-03-26
  • 打赏
  • 举报
回复
正是我想要的,谢谢!
水区混混 2012-03-26
  • 打赏
  • 举报
回复

#region API函数

[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32.dll")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string strClass, string strWindow);

[DllImportAttribute("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); //发送消息

private const int WM_LBUTTONDOWN = 513; // 0x0201 鼠标左键按下
private const int WM_LBUTTONUP = 514; // 0x0202 鼠标左键弹起

#endregion

public static int ClickErrorButton()
{
IntPtr hWnd = FindWindow(null, "Windows Internet Explorer");
hWnd = FindWindowEx(hWnd, IntPtr.Zero, "Button", "是(&Y)");
if (hWnd != IntPtr.Zero)
{
SendMessage(hWnd, WM_LBUTTONDOWN, 0, 0);
SendMessage(hWnd, WM_LBUTTONUP, 0, 0);
SendMessage(hWnd, WM_LBUTTONDOWN, 0, 0);
SendMessage(hWnd, WM_LBUTTONUP, 0, 0);
return 1;
}

return 0;
}

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧