Solved

Capture invisible webpage client area to off-screen Bitmap

Posted on 2001-08-21
3
236 Views
Last Modified: 2010-05-18
Hi

I am trying to capture a full webpage area without displaying the webpage.  

e.g. Type a URL into a single line edit box and hit a capture button, this would somehow create an offscreen browser that downloads the remote webpage and then when downloaded captures it to a bitmap file.

1. IE can be a requirement
2. Must not show a webpage anywhere
3. Must not require a WebBrowser visible prior to capture.
4. Must work on Win98 / Win2k

I know this is possible as I have seen it in another application.  Something about creating an off screen renderer and using print to capture the form area to a file.

So far I can capture the Web client area to a bitmap but must have a TWebBrowse / IE open to do it, which is not what I want.

I wouldn't say this question is easy but as a new user I only have 75 points.

Thanks
Geoff Coope
0
Comment
Question by:GeoffCoope
3 Comments
 
LVL 6

Accepted Solution

by:
edey earned 75 total points
ID: 6410685
have you tried just printing?  I'm pretty sure IE re-renders it's content anytime it prints.  I grabbe the following printing hints from http://members.home.com/hfournier :

Q: How do I Print?

A: There are a couple of ways to print. The first example works in IE 4.x and up, but you'll have to use the second example in IE 3.x:

var
  vaIn, vaOut: OleVariant;

...

WebBrowser.ControlInterface.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);

or

procedure TForm1.PrintIE;
var
  CmdTarget : IOleCommandTarget;
  vaIn, vaOut: OleVariant;
begin
  if WebBrowser1.Document <> nil then
    try
      WebBrowser1.Document.QueryInterface(IOleCommandTarget, CmdTarget);
      if CmdTarget <> nil then
        try
          CmdTarget.Exec( PGuid(nil), OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);
        finally
          CmdTarget._Release;
        end;
    except
      // Nothing
    end;
end;

Note: If you're not using Delphi 3.02 or higher, you'll have to change

PGuid(nil)
to
PGuid(nil)^
. And you really should upgrade to 3.02, if you're using 3.0 or 3.01.

 

GL
Mike
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6907105
Please update the experts here who have so willingly stepped in to help you, since much time has passed since your last comments, and Email notifications may not have been generated to the participating experts here due to some problems at that time.  If you've been helped, accept the respective question by that expert to grade and close it.

Somewhat off-topic, but important.

****************************** ALERT********************************
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015  
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0

Thought you'd appreciate knowing this.
":0)
Asta
0
 
LVL 17

Expert Comment

by:geobul
ID: 9287669
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept edey's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 152
Delphi selector screen 2 79
When i run adoquery my application freezes 26 166
How to load 2 images in same column in Delphi 2 47
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question