问题
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");
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.
回答1:
Getting the HWND is as simple as:
IntPtr hwnd = (IntPtr)IE.HWND;
来源:https://stackoverflow.com/questions/40433615/how-to-get-a-reference-to-internet-explorers-window-handle-in-net