Jednak będę się czepiał tej części kodu. Dla przykładu zrobiłem nowy projekt, w nim dodałem tylko Button i prosty test czyli robienie screen`a. Przy każdym kliknięciu program dokłada sobie pamięci prywatnej RAM.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TCanvas *mojCanvas = new TCanvas();
Graphics::TBitmap *mojaBitmapa = new Graphics::TBitmap;
mojCanvas->Handle = GetDC(0);
mojaBitmapa->Width = Screen->Width;
mojaBitmapa->Height = Screen->Height;
mojaBitmapa->Canvas->CopyRect(Rect(0, 0, mojaBitmapa->Width, mojaBitmapa->Height), mojCanvas, Rect(0, 0, mojaBitmapa->Width, mojaBitmapa->Height));
mojaBitmapa->SaveToFile("c:\\mojaBitmapa.bmp");
delete mojCanvas, mojaBitmapa;
}
//---------------------------------------------------------------------------