473,671 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.AxWeb Browser 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(A xSHDocVw.AxWebB rowser axWebBrowser1,
string fileName,
ImageFormat imageFormat)
{
// Handle to BrowserControl
IntPtr hwnd = axWebBrowser1.H andle;

// Get handle to Browser's ActiveX Window
int hdcSrc = User32.GetWindo wDC(hwnd.ToInt3 2()),
hdcDest = GDI32.CreateCom patibleDC(hdcSr c), // Creating memory device
context
hBitmap = GDI32.CreateCom patibleBitmap(h dcSrc, // Creating Bitmpat in
memory
axWebBrowser1.W idth, axWebBrowser1.H eight); // Width and Heigth of the
Browser's Window
// For creating color bitmap
GDI32.SelectObj ect(hdcDest,hBi tmap);
// 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(hd cDest, 0, 0,
GDI32.GetDevice Caps(hdcSrc,8), // Width of destination rectangle
GDI32.GetDevice Caps(hdcSrc,10) , // Heigth of destination rectangle
hdcSrc,0,0,0x00 CC0020);

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

Dec 14 '05 #1
0 3552

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

Similar topics

3
13500
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 capture part. The code is as follows, the commented out lines at the end are things I have tried, but don't work. Whenever I try to create a compatibe Bitmap or DC it comes back with an error as win32ui: CreateCompatibleDC failed
5
3598
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 that cover my screen shot window). I have tried this in both MCF and pure win32 but with the same result. I know i can set the window i want to capture to the front/top with commands such as SetForegroundWindow() and SetWindowPos(). The
5
2369
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 how to do this - - all I want to do is copy a Form’s image to a bitmap. - - In effect, I want to take a window-shot of a Form, (as opposed to a “screen-shot”) but it must be done before that Form hits the screen. Anyone? Ideas?
3
5646
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 Framework. And I see others doing the same mis-posting to dotnet.general which appears to be gearded more towards windows applications. What are General and Framework for options under .NET Development! After exhausting my search on the MS...
3
10203
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 probablem has come back even if both are installed. When I open a windows form that has the Browser on it and try to Navigate to a page using the OnEnter or OnLoad events, the page just sits there and does
18
11641
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
10843
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 this. While PIL.ImageGrab.grab() is excellent, it will only capture the foreground of the desktop. I've tried for hours, but I soon get helplessly lost in the labyrinths of the Win32API.
1
4494
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 an image of that web site so that it can be displayed later as a thumbnail image. I have code for taking a normal screen capture using GDI+ which works fine. What I am now trying to do is to modify it so the screen capture is of a remote...
0
8938
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 problem, bounded rectangle problem. PointToClient, PointToScreen Beware this newbie trap for the unwary. It goes by various names (in some old MFC literature I saw some of the keywords above). Whenever doing comparisons between points,...
0
8483
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8926
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8603
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8673
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6236
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2818
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.