![](/img/trans.png)
[英]How to get the URL from the focused Internet Explorer browser 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");
我想引用它的窗口句柄進行進一步的操作,但是如何做到這一點的唯一例子是在C ++中,我不知道如何在C#中做類似的事情。 msdn給出的例子就在這里 。
獲得HWND非常簡單:
IntPtr hwnd = (IntPtr)IE.HWND;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.