views:

227

answers:

1

Hello, 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 be able to do this:

MessageBox.Show(Process.GetCurrentProcess().MainWindowHandle.ToString());

But it always returns '0' as the HWND.

A: 

Keep in mind that you are strongly discouraged from writing browser add-ons in .NET. http://stackoverflow.com/questions/1161489/how-do-i-write-an-ie-8-add-on-in-pure-managed-c/1161529#1161529

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

EricLaw -MSFT-