Registriert seit: 3. Sep 2014
38 Beiträge
|
AW: Suche "echte" Screenshot Funktion
29. Jan 2015, 10:13
Ich verwende folgendes:
Delphi-Quellcode:
procedure TRTLCommon.WriteScreenshot;
const
CAPTUREBLT = $40000000;
var
hdcScreen: HDC;
hdcCompatible: HDC;
bmp: TBitmap;
hbmScreen: HBITMAP;
DeskHeight,
DeskWidth: Integer;
begin
hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
hdcCompatible := CreateCompatibleDC(hdcScreen);
try
DeskHeight:= Screen.DesktopHeight;
DeskWidth:= Screen.DesktopWidth;
hbmScreen := CreateCompatibleBitmap(hdcScreen, DeskWidth, DeskHeight);
try
SelectObject(hdcCompatible, hbmScreen);
bmp := TBitmap.Create;
try
bmp.Handle := hbmScreen;
BitBlt(hdcCompatible, 0, 0, bmp.Width, bmp.Height, hdcScreen, 0, 0, SRCCOPY or CAPTUREBLT);
bmp.Save....
finally
bmp.Free;
end;
finally
DeleteObject(hbmScreen);
end;
finally
DeleteDC(hdcScreen);
DeleteDC(hdcCompatible);
end;
end;
|
|
Zitat
|