|
28 Apr |
ScreenShot erstellen und JPG-Datei speichern Borland C++ Builder
|
#include <jpeg.hpp>
HDC dc = GetDC(NULL);
TJPEGImage *pJPG_Bild = new TJPEGImage();
Graphics::TCanvas *ScreenCanvas = new Graphics::TCanvas();
ScreenCanvas->Handle = dc;
thescreen->AutoSize = true;
thescreen->Center = true;
thescreen->Top = 0;
thescreen->Left = 0;
thescreen->Picture->Bitmap->Width = Screen->Width;
thescreen->Picture->Bitmap->Height= Screen->Height;
TRect rect = Rect(0,0,Screen->Width, Screen->Height);
thescreen->Picture->Bitmap->Canvas->CopyRect(rect, ScreenCanvas, rect);
ReleaseDC(NULL,dc);
pJPG_Bild->Assign(thescreen->Picture->Bitmap);
pJPG_Bild->CompressionQuality = 50;
pJPG_Bild->SaveToFile(“test.jpg”);
delete pJPG_Bild;
delete ScreenCanvas;
