如何在 .net 中获取对 Internet Explorer window 句柄的引用
How to get a reference to Internet Explorer's window handle in .net
基本上我试图获取我在 C# 中自动化的 Internet Explorer 实例的 HWND。
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.AddressBar = false;
IE.MenuBar = false;
IE.OnQuit += IE_OnQuit;
IE.Visible = true;
IE.Navigate2("www.bing.com");
我想获得对它的 window 句柄的引用以进行进一步操作,但是如何执行此操作的唯一示例是在 C++ 中,我不确定如何在 C# 中执行类似的操作。 msdn给出的例子是here.
获取 HWND 非常简单:
IntPtr hwnd = (IntPtr)IE.HWND;
基本上我试图获取我在 C# 中自动化的 Internet Explorer 实例的 HWND。
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.AddressBar = false;
IE.MenuBar = false;
IE.OnQuit += IE_OnQuit;
IE.Visible = true;
IE.Navigate2("www.bing.com");
我想获得对它的 window 句柄的引用以进行进一步操作,但是如何执行此操作的唯一示例是在 C++ 中,我不确定如何在 C# 中执行类似的操作。 msdn给出的例子是here.
获取 HWND 非常简单:
IntPtr hwnd = (IntPtr)IE.HWND;