473,390 Members | 1,235 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Screen capture with IE AxWebBrowser control and hidden Window


I'm trying to capture hidden window's data that is in IE's
AxSHDocVw.AxWebBrowser ActiveX control.

If Control and window are visible, code below works but if Control
and it's window is hidden e.g. emmedded in dll, code does not save
data as an picture. How should I handle this kind of situation?

How can I get data printed to file if AxWebBrowser is hidden and
in dll file?


public void CaptureWindow(AxSHDocVw.AxWebBrowser axWebBrowser1,
string fileName,
ImageFormat imageFormat)
// Handle to BrowserControl
IntPtr hwnd = axWebBrowser1.Handle;

// Get handle to Browser's ActiveX Window
int hdcSrc = User32.GetWindowDC(hwnd.ToInt32()),
hdcDest = GDI32.CreateCompatibleDC(hdcSrc), // Creating memory device
hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, // Creating Bitmpat in
axWebBrowser1.Width, axWebBrowser1.Height); // Width and Heigth of the
Browser's Window
// For creating color bitmap
// Performs a bit-block transfer of the color data corresponding to a
rectangle of
// pixels from the specified source device context into a destination
device context
GDI32.BitBlt(hdcDest, 0, 0,
GDI32.GetDeviceCaps(hdcSrc,8), // Width of destination rectangle
GDI32.GetDeviceCaps(hdcSrc,10), // Heigth of destination rectangle

// Saving Bitmap as file. Format can be e.g. gif, jpeg, tiff etc.
SaveImage(hBitmap, fileName, imageFormat);
// Releasing resources
User32.ReleaseDC(hwnd.ToInt32(), hdcSrc);

Dec 14 '05 #1
0 3537

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
by: Sambucus | last post by:
Hi all!. I'm trying to capture a screen shot of a window. This works good until the window is partly or completley hidden, then i get the graphics of what is visible on my screen (the windows...
by: Stan Shankman | last post by:
C# -- Visual Studio.Net – Windows Application Greetings all, How do I copy a Form’s image to a bitmap? – And do so before it gets to the screen. I haven’t been able to find anyone that knows...
by: Chris | last post by:
I think I placed this in the wrong news group so I'm moving it here. Suggestion to Microsoft make the categories more clear and make better sense. ASP.NET should be its own group, why bury under...
by: Clint MacDonald | last post by:
I have used the AxWebBrowser in a Visual Basic Project... I found that both Framework 1.0 and 1.1 had to be installed for it to work properly. I now have found that in Studio 2003, that the...
by: DavidS | last post by:
Have resW=screen.width; resH=screen.height in javascript. How can I read these values in ASP.NET source code - Page_Load function of code behind? Any suggestions?
by: Rune Strand | last post by:
Is it possible by use of pyWin32 or ctypes to make a screen capture of an inactive, or a hidden window if the hwnd/WindowName/ClassName is known? I've seen dedicated screen capture software do...
by: JP2006 | last post by:
I'm trying to write a control that will take a screen capture of a particular website when a user submits a form in a web application; one of the form fields is for a URL - the control needs to get...
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.