//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
      AnsiString msg;
      static int i=0;
      msg.sprintf("Screen Shoot %d",i++);
      lblShot->Caption=msg;
      HDC dc = GetDC(0);
      Graphics::TCanvas *s = new Graphics::TCanvas;
      s->Handle=dc;


      screenImage = new TImage(Form1);
      screenImage->Picture->Bitmap->Width=Screen->Width;
      screenImage->Picture->Bitmap->Height=Screen->Height;
      TRect rect = Rect ( 0, 0,Screen->Width, Screen->Height);
      screenImage->Picture->Bitmap->Canvas->CopyRect(rect,s, rect );
      screenImage->Picture->Bitmap->SaveToFile("c:\\a.bmp");

      delete s;
      delete screenImage;
      ReleaseDC (NULL,dc);


      Image1->Picture->Bitmap->LoadFromFile( "c:\\a.bmp" );
      
}
//---------------------------------------------------------------------------

