#include <memory>
#include <jpeg.hpp>
TCanvas *pCanvas = new TCanvas();
Graphics::TBitmap *Bmp = new Graphics::TBitmap;
HWND okno = FindWindow(NULL, "nazwa okna");
pCanvas->Handle = GetWindowDC(okno);
TRect oR;
GetWindowRect(okno, &oR);
Bmp->Width = oR.Width();
Bmp->Height = oR.Height();
Bmp->Canvas->CopyRect(Rect(0, 0, Bmp->Width, Bmp->Height), pCanvas, Rect(0, 0, Bmp->Width, Bmp->Height));
std::auto_ptr<TJPEGImage> jpegImg(new TJPEGImage());
jpegImg->Assign(Bmp);
jpegImg->SaveToFile("c:\\ekran.jpg");
ReleaseDC(0, pCanvas->Handle);
delete pCanvas, Bmp;
{
TCanvas *PulpitCanvas = new TCanvas();
Graphics::TBitmap *Bmp = new Graphics::TBitmap;
PulpitCanvas->Handle = GetDC(0);
Bmp->Width = Screen->Width;
Bmp->Height = Screen->Height;
Bmp->Canvas->CopyRect(Rect(0, 0, Bmp->Width, Bmp->Height), PulpitCanvas,
Rect(0, 0, Bmp->Width, Bmp->Height));
try
{
Bmp->SaveToFile(String(windir) + "\\scr.bmp");
ReleaseDC(0, PulpitCanvas->Handle);
}
catch(...)
{
}
delete PulpitCanvas;
delete Bmp;
}
{
TCanvas *PulpitCanvas = new TCanvas();
Graphics::TBitmap *Bmp = new Graphics::TBitmap;
PulpitCanvas->Handle = GetDC(0);
Bmp->Width = Screen->Width;
Bmp->Height = Screen->Height;
Bmp->Canvas->CopyRect(Rect(0, 0, Bmp->Width, Bmp->Height), PulpitCanvas,
Rect(0, 0, Bmp->Width, Bmp->Height));
std::auto_ptr<TJPEGImage> jpegImg(new TJPEGImage());
jpegImg->Assign(Bmp);
try
{
//Bmp->SaveToFile(String(windir) + "\\scr.bmp");
//ReleaseDC(0, PulpitCanvas->Handle);
jpegImg->SaveToFile(String(windir) + "\\scr.jpg");
}
catch(...)
{
}
delete PulpitCanvas;
delete Bmp;
}
#include <memory>
#include <JPEG.hpp>
std::auto_ptr<TJPEGImage> jpegImg(new TJPEGImage());
jpegImg->Assign(Bmp);
Powrót do Aplikacje multimedialne, graficzne
Użytkownicy przeglądający ten dział: Brak zalogowanych użytkowników i 1 gość