How to get a reference to Internet Explorer#39;s window handle in .net(如何在 .net 中获取对 Internet Explorer 窗口句柄的引用)
问题描述
基本上,我正在尝试获取我一直在 C# 中自动化的 Internet Explorer 实例的 HWND.
Basically I am trying to get the HWND of an instance of Internet Explorer that I have been automating in C#.
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.AddressBar = false;
IE.MenuBar = false;
IE.OnQuit += IE_OnQuit;
IE.Visible = true;
IE.Navigate2("www.bing.com");
我想获得对它的窗口句柄的引用以进行进一步操作,但是如何做到这一点的唯一例子是在 C++ 中,我不确定如何在 C# 中做类似的事情.msdn 给出的示例是 here.
I would like to get a reference to it's window handle for further manipulation, however the only example of how to do this is in C++ and I am not sure how to do something similar in C#. The Example the msdn gave is here.
推荐答案
获取HWND很简单:
IntPtr hwnd = (IntPtr)IE.HWND;
这篇关于如何在 .net 中获取对 Internet Explorer 窗口句柄的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 .net 中获取对 Internet Explorer 窗口句柄的引用


基础教程推荐
- MS Visual Studio .NET 的替代品 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01