delphi 简单的截图代码


本文整理自网络,侵删。

 program JieTug;

{$APPTYPE CONSOLE}

uses
Windows,
Graphics,
Jpeg;

function PrintWindow(SourceWindow: hwnd; Destination: hdc; nFlags: cardinal): bool; stdcall; external 'user32.dll' name 'PrintWindow';

procedure JieTu(); stdcall;
var
bmp : TBitmap;
wnd : cardinal;
Jpg:Tjpegimage;
rec : TRect;
begin
wnd := FindWindow(nil,'计算器');
if wnd <> 0 then
begin
GetWindowRect(wnd,rec);
bmp := TBitmap.Create;//??建一??BITMAP?泶娣?D像
Jpg:=Tjpegimage.Create;//??建一??jpeg?泶娣?D像
try
bmp.Width := rec.Right - rec.Left; //创建高宽
bmp.Height := rec.Bottom - rec.Top;//创建高宽
PrintWindow(wnd, bmp.Canvas.Handle, 0);//
Jpg.Assign (bmp);//复制抓到的屏幕
Jpg.SaveToFile('1.jpg');//保存地址
bmp.Free;
Jpg.Free;
finally
end; //////这个代码EXE200多K 能不能变小点
end;
end;
begin
JieTu;
end.

相关阅读 >>

Delphi webbrowser1去边框

Delphi tfdconnection只能取得50处理

Delphi中in的使用

Delphi 字符串查找函数

Delphi stringtowidestring widestringtostring

Delphi判断字符串是否是数字、字母、大小写字母

Delphi windows 编程[1] - 窗体生成的过程一

Delphi中使用词霸2005的动态库xdictgrb.dll实现屏幕取词

sqlite中的pragma语句攻略

Delphi中操作powerpoint幻灯片的示例代码

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



打赏

取消

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

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

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

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

评论

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