//---------------------------------------------------------------------------
int __fastcall CaptureRegion(HDC Dest, int x1, int y1, int x2, int y2)
{
HDC hdc=GetDC(0);
BitBlt(hdc, 0, 0, Screen->Width, Screen->Height, hdc, 0, 0, SRCCOPY);
TPoint MovePt, Origin;
MovePt.x=x1;
MovePt.y=y1;
Origin.x=x2;
Origin.y=y2;
if ((MovePt.y-Origin.y) !=0)
{
int KAWidth = abs(MovePt.x-Origin.x);
int KAHeight = abs(MovePt.y-Origin.y);
int Orgx = Origin.x;
int Orgy = Origin.y;
if (MovePt.x < Origin.x) Orgx = MovePt.x;
if (MovePt.y < Origin.y) Orgy = MovePt.y;
int Result = StretchBlt(Dest, 0, 0, KAWidth, KAHeight, hdc, Orgx, Orgy, KAWidth, KAHeight, SRCCOPY);
ReleaseDC(0,hdc);
return Result;
}
else
{
return 0;
}
}
//---------------------------------------------------------------------------