Search code examples
c#winapiaerodwm

How do I display open IE tabs as DWM thumbnails?


I am building a WPF application in C# and I want to display thumbnails of open IE tabs in a listbox. I'm essentially trying to duplicate the DWM functionality in Windows 7.

Windows 7 showing open IE tabs

I have figured out how to enumerate a list of open tabs using Interop.ShDocVW, but in order to use the DWM API calls, I have to pass in an hwnd, and the tabs all share the same handle as Internet Explorer.

So I've been messing with EnumWindows and EnumChildWindows but I can't get anything to work.

Any suggestions on how to best approach this?


Solution

  • The solution I went with was using EnumWindows and GetWindowText from the Win32 API. I enumerate through Internet Explorer windows using shdocvw.dll and pass the tab's caption to a method that parses the results of GetWindowText to find the hwnd of the window with that caption.

    This works for all IE windows, not just tabs.