Webbrowser control screen shot - a Challenging task
-
Dear All; I am hosting a microsoft web browser control (assuming it has got a variable: m_webBrowser) on a dialog box. I want to capture a screen shot of the content of the web browser (excluding the main window). Does anyone know or have any idea how to save the content of web browser as an image? I have tried this:
RECT rc; HWND hWnd = m_webBrowser.GetSafeHwnd(); ::GetWindowRect (hWnd,&rc); HDC hDC = ::GetDC(0); HDC memDC = ::CreateCompatibleDC ( hDC ); HBITMAP memBM = ::CreateCompatibleBitmap ( hDC, rc.right-rc.left, rc.bottom-rc.top ); ::SelectObject ( memDC, memBM ); ::BitBlt( memDC, 0, 0, rc.right-rc.left, rc.bottom-rc.top , hDC, rc.left, rc.top , SRCCOPY );
But it only saves the visible area of the web browser and not all the content:confused:!!! I will be very gratefull if anyone can help with this problem as it is giving me a real headache X| .llp00na
-
Dear All; I am hosting a microsoft web browser control (assuming it has got a variable: m_webBrowser) on a dialog box. I want to capture a screen shot of the content of the web browser (excluding the main window). Does anyone know or have any idea how to save the content of web browser as an image? I have tried this:
RECT rc; HWND hWnd = m_webBrowser.GetSafeHwnd(); ::GetWindowRect (hWnd,&rc); HDC hDC = ::GetDC(0); HDC memDC = ::CreateCompatibleDC ( hDC ); HBITMAP memBM = ::CreateCompatibleBitmap ( hDC, rc.right-rc.left, rc.bottom-rc.top ); ::SelectObject ( memDC, memBM ); ::BitBlt( memDC, 0, 0, rc.right-rc.left, rc.bottom-rc.top , hDC, rc.left, rc.top , SRCCOPY );
But it only saves the visible area of the web browser and not all the content:confused:!!! I will be very gratefull if anyone can help with this problem as it is giving me a real headache X| .llp00na
-
Check out the excellent article http://www.codeproject.com/internet/htmlimagecapture.asp[^]