?? caplib.dpr
字號:
library caplib;
uses
Windows, pngimage;
function GetDesktopBitmap: HBitmap;
var
DC, MemDC: HDC;
Bitmap, OBitmap: HBitmap;
BitmapWidth, BitmapHeight: integer;
begin
DC := GetDC(GetDesktopWindow);
MemDC := CreateCompatibleDC(DC);
BitmapWidth := GetDeviceCaps(DC, 8);
BitmapHeight := GetDeviceCaps(DC, 10);
Bitmap := CreateCompatibleBitmap(DC, BitmapWidth, BitmapHeight);
OBitmap := SelectObject(MemDC, Bitmap);
BitBlt(MemDC, 0, 0, BitmapWidth, BitmapHeight, DC, 0, 0, SRCCOPY);
SelectObject(MemDC, OBitmap);
DeleteDC(MemDC);
ReleaseDC(GetDesktopWindow, DC);
Result := Bitmap;
end;
procedure Capture();
var
PNGObject : TPNGObject;
begin
PngObject := TPngObject.Create;
PngObject.AssignHandle(GetDesktopBitmap, False, 0);
PngObject.CompressionLevel := 9;
PngObject.SaveToFile('shot.png');
PngObject.Free;
end;
exports
Capture;
begin
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -