delphi抓屏代码


本文整理自网络,侵删。

 delphi抓屏代码

procedure TForm1.Button1Click(Sender: TObject);
var winHWND, hCur:integer;
winDC:integer;
rect:TRect;
//AFormat : Word;
//AData,APalette : THandle;
pt:TPoint;
fBitmap:TBitmap;
timer11:Integer;
begin
timer11:=GetTickCount;
hCur := GetCursor(); // 获 得 光 标 句 柄
GetCursorPos(pt); // 记 录 光 标 位 置
winHWND := GetDesktopWindow();
winDC := GetDC(winHWND);
GetWindowRect(winHWND, rect);
fBitmap := TBitmap.create;
fBitmap.width := rect.right-rect.left;
fBitmap.height := rect.bottom-rect.top;
BitBlt(fBitmap.canvas.handle, 0, 0, fBitmap.width, fBitmap.height, winDC, 0, 0, SRCCOPY);
DrawIcon(fBitmap.canvas.handle, pt.x, pt.y, hCur); // 画 光 标
ReleaseDC(winHWND, winDC);
Image1.Picture.Bitmap:= fBitmap;
fBitmap.Free;
Caption:=inttostr( GetTickCount-timer11);
end;

相关阅读 >>

Delphi 的内存操作函数(6): 跨进程的内存分配

Delphi 如何获取窗口的图标

Delphi里label显示多行文本的两种方法

Delphi 屏幕拷贝程序的源代码

Delphi trim 删除字符串左右两边的空格

Delphi 是否是闰年- isleapyear、isinleapyear

Delphi的combobox不能输入只能选择

Delphi 中流的使用通过内存流读取文件

Delphi 获取网络文件大小

Delphi idhttp1post上传图片

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...