Take screenshot of div in InternetExplorer

637 views Asked by At

I am using mshtml.InternetExplorer object within my winforms application to browse a web application. Somehow I can't use webbrowser in my solution. Now I need to capture screenshot of a div element inside this web application. I see lots of solutions doing similar functionality using webbrowser's drawtobitmap method but none is using mshtml.InternetExplorer. Is there way to achieve this functionality ? Is there some way that I can type cast InternetExplorer object into webbrowser?

1

There are 1 answers

2
noseratio On

You should be able to capture the desired part of the main IE window using PrintWindow Windows API, as explained here. You can get the handle of the window by calling IWebBrowser2::HWND on the IE object. Some other methods could also help to make this happen: