I managed to get it to work on my web pages in IE8 with the following changes:
Replace the following method:
private static IntPtr GetHwndForInternetExplorerServer(IntPtr hwnd) { var sbc = new StringBuilder(256); hwnd = NativeMethods.GetWindow(hwnd, NativeMethods.GW_CHILD); while (hwnd != IntPtr.Zero) { NativeMethods.GetClassName(hwnd, sbc, 256); if (sbc.ToString().IndexOf("Shell DocObject View", 0) > -1) //IE6 { hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero); break; } if (sbc.ToString().IndexOf("TabWindowClass", 0) > -1) //IE7 { hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "Shell DocObject View", IntPtr.Zero); hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero); break; } if (sbc.ToString().IndexOf("Frame Tab", 0) > -1) // IE8 { hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "TabWindowClass", IntPtr.Zero); hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "Shell DocObject View", IntPtr.Zero); hwnd = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero); break; } hwnd = NativeMethods.GetWindow(hwnd, NativeMethods.GW_HWNDNEXT); } return hwnd; }
Remove the GetHwndContainingShellDocObjectView method and call to it.
source share