473,387 Members | 1,483 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,387 software developers and data experts.

Screen capture with IE AxWebBrowser control and hidden Window

Hi,

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?

Cheers,

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
context
hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, // Creating Bitmpat in
memory
axWebBrowser1.Width, axWebBrowser1.Height); // Width and Heigth of the
Browser's Window
// For creating color bitmap
GDI32.SelectObject(hdcDest,hBitmap);
// 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
hdcSrc,0,0,0x00CC0020);

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

Dec 14 '05 #1
0 3535

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

Similar topics

3
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...
5
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...
5
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...
3
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...
3
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...
18
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?
2
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...
1
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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.