All you have to do is use
GetDC and assign that to the HDC of your printers canvas 
EG

Procedure GetScreenDump;
var
  theDC : HDC;
begin
  theDC := GetDC(Screen.ActiveForm.Handle); //Get DC of Active Form - To Get
Desktop use 0
  Printer.Canvas.Handle := theDC; // I am pretty sure this will work. I had
used a TImage Canvas
end;

As for Trapping the Print Screen see below [from Delphi FAQ's]

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

const id_SnapShot = 101;

procedure TForm1.WMHotKey (var Msg : TWMHotKey);
begin
  if Msg.HotKey = id_SnapShot then
    ShowMessage('GotIt');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterHotKey(Form1.Handle,
                 id_SnapShot,
                 0,
                 VK_SNAPSHOT);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  UnRegisterHotKey (Form1.Handle, id_SnapShot);
end;


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 7 June 2000 13:53
To: Multiple recipients of list delphi
Subject: [DUG]:


Greetings!

I'm after an API to do the equivalent of pressing the <Print Screen> button
on 
the keyboard. In other words, I want to send the current screen to the 
clipboard, not the current form! - the form will not be visible anyway, I 
actually want what the current screen contains as a bitmap.

Laurie
Bisman..

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz



CAUTION - This message may contain privileged and confidential information intended 
only for the 
use of the addressee(s) named above.  If you are not the intended recipient of this 
message you are 
hereby notified that any use, dissemination, distribution or reproduction of this 
message is prohibited.  
If you have received this message in error please notify Progressive Enterprises Ltd. 
immediately via 
email at [EMAIL PROTECTED]  Any views expressed in this message 
are those of the 
individual sender and may not necessarily reflect the views of Progressive Enterprises 
Ltd.

This footnote also confirms that Progressive Enterprises Ltd. has swept this email 
message for the 
presence of computer viruses.  This does not guarantee this message is virus free.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to