delphi android 截屏,Delphi 截图\截屏

procedure TForm1.GetActiveWndImg;

var C: TCanvas; b: TBitmap; H: HDC; R: TRect; hand: THandle;

p: TPoint;

J: TJpegImage;

m, n: INTEGER;

name: array[0..255] of char;

begin

B := TBitmap.Create;

C := TCanvas.Create;

GetCurSorPos(P); //取得鼠标所在区域坐标

Hand := WindowFromPoint(P); //取得坐标所在窗体句柄

FillChar(name, SizeOf(name), #0); //

GetWindowText(Hand, name, 255); // 取得窗口标题

if name = '' then CopyMemory(@name, PCHAR(inttostr(hand)), Length(inttostr(hand)) + 1); //用句柄

if hand = 0 then exit;

H := GetWindowDC(Hand); //获取整个窗口(包括边框、滚动条、标题栏、菜单等)的设备场景 返回值 Long

try

GetWindowRect(hand, R); //取得句柄对应窗体的矩形区域

B.Width := R.Right - R.Left;

B.Height := R.Bottom - R.Top;

C.Handle := H; //将描述表赋给画布的句柄,此时画布就代表整个屏幕了

B.Canvas.CopyRect(Rect(0, 0, B.Width, B.Height), C, Rect(0, 0, B.Width, B.Height));

//Image1.Picture.Bitmap.Assign(B);

finally

C.Free;

B.Free;

ReleaseDC(Hand, H); //释放设备上下文环境

end;

end;

以前写的一个类似软件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值