[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Print Screen

Posted on 1998-12-01
8
Medium Priority
?
266 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

649 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