Article View: borland.public.cppbuilder.migration
Article #60Re: How to capture the Screen in C++Builder3.0?
From: Andrea Biasi
Date: Sun, 07 Nov 2004 19:33
Date: Sun, 07 Nov 2004 19:33
38 lines
2178 bytes
2178 bytes
Hi cesar,
I use this code for capture screen to jpg file:
HDC dc = GetDC(0);
Graphics::TCanvas *ScreenCanvas = new Graphics::TCanvas;
ScreenCanvas->Handle = dc;
Image1->Picture->Bitmap->Width = Screen->Width;
Image1->Picture->Bitmap->Height= Screen->Height;
TRect rect = Rect(0,0,Screen->Width, Screen->Height);
Image1->Picture->Bitmap->Canvas->CopyRect(rect, ScreenCanvas, rect);
delete ScreenCanvas;
ReleaseDC(NULL,dc);
AnsiString datehour = FormatDateTime("yyyymmdd-hhnnss",Now());
TJPEGImage *jp = new TJPEGImage();
try {
jp->Assign(Image1->Picture->Bitmap);
jp->CompressionQuality=StrToInt(50);
jp->SaveToFile(datehour+".jpg");
}
__finally
{
delete jp;
}
Andrea Biasi
"C�sar" <lupus@usp.br> ha scritto nel messaggio
news:4179b0f5$1@newsgroups.borland.com...
>
> Hi there,
> I am trying to figure out achieve a Bitmap "ala" "Print Screen".
> Any Hint? The famous "Screen" variable can be used to do this?
> Thanks in advance,
> C�sar
Technical Details
Message-ID:
<418e78b1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!demon!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4179b0f5$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 110f51,89a19585ba9ebd20 X-Google-Attributes: gid110f51,public X-Google-Language: ENGLISH,ASCII From: "Andrea Biasi" <andrea.biasi@cheapnet.it> Newsgroups: borland.public.cppbuilder.migration References: <4179b0f5$1@newsgroups.borland.com> Subject: Re: How to capture the Screen in C++Builder3.0? Date: Sun, 7 Nov 2004 20:33:29 +0100 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 80.182.54.126 Message-ID: <418e78b1$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099856049 80.182.54.126 (7 Nov 2004 11:34:09 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!demon!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail