?
Solved

Print Screen

Posted on 1998-12-01
8
Medium Priority
?
265 Views
Last Modified: 2010-04-04
Hi
How do I do a Print Screen and also printing all active child windows at a time

VSP
0
Comment
Question by:v_pasupuleti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 

Author Comment

by:v_pasupuleti
ID: 1348779
Edited text of question
0
 

Author Comment

by:v_pasupuleti
ID: 1348780
Adjusted points to 100
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1348781
Hi v,

Well try this,

procedure TForm1.Button1Click(Sender: TObject);
var
  DeskTop: TCanvas;
begin
  DeskTop := TCanvas.Create;
  try
    with DeskTop do Handle := GetWindowDC(GetDesktopWindow);
    Image1.BoundsRect := Desktop.ClipRect;
    with Image1.Canvas do
      CopyRect(Image1.BoundsRect, DeskTop, DeskTop.ClipRect)
  finally
    DeskTop.Free
  end;
  PrintImage;
end;

procedure TForm1.PrintImage;
var
  ScaleX, ScaleY: Integer;
  R  : TRect;
  Printer: TPrinter;
begin
  Printer := TPrinter.Create;
  try
    Printer.BeginDoc;
    with Printer do
    try
      ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
      ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
      R := Rect(0, 0, Image1.Picture.Width * ScaleX,
        Image1.Picture.Height * ScaleY);
      Canvas.StretchDraw(R, Image1.Picture.Graphic);
    finally
      EndDoc;
    end;
  except
    on E: Exception do showmessage(E.Message);
  end;
  Printer.Free;
end;

Just didn't have the change to test it on a printer yet, but it should get you going. It is a simple example of copying the desktop to an image and printing the image.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:v_pasupuleti
ID: 1348782
Thanks Bruintje,
It works.

Vijay
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1348783
Hmm...
Should I repost it as an answer?
0
 
LVL 44

Accepted Solution

by:
bruintje earned 300 total points
ID: 1348784
Well I do... :O)

procedure TForm1.Button1Click(Sender: TObject);
var
  DeskTop: TCanvas;
begin
  DeskTop := TCanvas.Create;
  try
    with DeskTop do Handle := GetWindowDC(GetDesktopWindow);
    Image1.BoundsRect := Desktop.ClipRect;
    with Image1.Canvas do
      CopyRect(Image1.BoundsRect, DeskTop, DeskTop.ClipRect)
  finally
    DeskTop.Free
  end;
  PrintImage;
end;

procedure TForm1.PrintImage;
var
  ScaleX, ScaleY: Integer;
  R  : TRect;
  Printer: TPrinter;
begin
  Printer := TPrinter.Create;
  try
    Printer.BeginDoc;
    with Printer do
    try
      ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
      ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
      R := Rect(0, 0, Image1.Picture.Width * ScaleX,
        Image1.Picture.Height * ScaleY);
      Canvas.StretchDraw(R, Image1.Picture.Graphic);
    finally
      EndDoc;
    end;
  except
    on E: Exception do showmessage(E.Message);
  end;
  Printer.Free;
end;

And goodluck...
0
 

Author Comment

by:v_pasupuleti
ID: 1348785
I accept it Bruintje, as a answer
Thanks again

Vijay
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1348786
My pleasure :O)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

765 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