Hello All!

In one of my current projects, I need to figure out the height of Web Page that's displayed inside WebBrowser control. I don't have any control on the URL that will feed the page; but what I'm required to do is: by some ways, I need to find the height for Web Browser control in such a way that User won't need to scroll the window and every thing will appear just there. I also require this for taking snap shot of the "full" web page without scroll bars.

I tried many different ways to achieve it but no luck! The ClientHeight and ClientWidth properties of HTMLDocument does not give me the height and width of Web Page; in fact it returns the Height and Width of the Web Browser control itself, which is not a desired result. With the help of Microsoft HTML Object Library, I also tried out the HTMLDocument.scrollBy method. This method perfectly scrolls the web page automatically but there is no feedback on whether it has reached the maximum or still to go. So, my code remains unsure if it has scrolled down completely or not.

I was thinking to manually scroll the Web Browser window in such a way that will return either some error with specific error number or zero or true/false when the scroll bar reaches the maximum. I tried SendMessage with the same anticipation and sent WM_VScroll to the Web Browser's hWnd by passing SB_Vert as wParam and 0& as lParam. However, this even didn't scroll Web Browser window! :-)

Can anybody please tell me how can I get the Height of HTML document inside Web Browser control? I know there must some way to do this as there are quite a few ActiveX controls that take "full" snap-shop of a Web Page fetched from a URL that's passed to it. So, I'm certain that I'm not looking for something very new and something that needs to be invented. It's there in market ... just the thing is that I don't know (nor I have any clue on) how to do it.

Any link, code snippet or anything that you feel can take me several steps forward then that will be a great help for me!

Waiting for your valuable reply ...

Regards,

Ruturaaj.