I'm developing a toolbar for IE, and I need my toolbar to be able to get the HWND of the containing IE window. It needs to be accurate so that multiple tabs in the same window will all return the same HWND, but different from another IE window.
What would be the best way about this? I should b开发者_运维知识库e able to do this:
MessageBox.Show(Process.GetCurrentProcess().MainWindowHandle.ToString());
But it always returns '0' as the HWND.
Keep in mind that you are strongly discouraged from writing browser add-ons in .NET. How do I write an IE 8 Add-On in pure managed C#
Which HWND do you want-- the outer window, or the window handle of the rendering canvas?
Check out this article and code sample: http://msdn.microsoft.com/en-us/library/aa752126(VS.85).aspx
精彩评论