惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - xujh

C# 同步两个子目录文件 ASP.NET中突破上传4M文件的限制 【转】一种在SQLServer中实现Sequence的高效方法 DevExpress的ASPxGridView中实现Master-Detail数据动态绑定 【转】浅谈:国内软件公司为何无法做大做强? - xujh - 博客园 一个正则表达式测试(只可输入中文、字母和数字) - xujh - 博客园 IE6、7下如何设置页面内部件高度和窗口等高(heihgt:100%) HP大中华区总裁孙振耀退休感言 C#的一个双缓冲显示的例子 【ASP.NET】防止ASP.NET按钮多次提交的办法 【ASP.NET】FCKeditor 2.6 + Asp.Net 设置 【ASP.NET】FreeTextBox的使用方法 在VS2005下配置手机设备仿真器访问局域网 C# 画圆角矩形 有意思的加菲猫语录 [Delphi]用Delphi7访问.NET 2.0的WebService 转贴[ASP.NET]基于Forms认证的WebService应用 ASP.NET优秀博客搜集 [转贴]DataGrid中的高级ToolTip
[Delphi] 截屏存盘
xujh · 2007-04-28 · via 博客园 - xujh

截取屏幕,并保存为JPEG文件格式

 1 using jpeg,ExtCtrls;
 2 procedure TForm1.ScreenCap(LeftPos,TopPos,RightPos,BottomPos:integer);
 3 var
 4   RectWidth,RectHeight:integer;
 5   SourceDC,DestDC,Bhandle:integer;
 6   Bitmap:TBitmap;
 7   MyJpeg: TJpegImage;
 8   Stream:TMemoryStream;
 9 begin
10   MyJpeg:= TJpegImage.Create;
11   RectWidth:=RightPos-LeftPos;
12   RectHeight:=BottomPos-TopPos;
13   SourceDC:=CreateDC('DISPLAY','','',nil);
14   DestDC:=CreateCompatibleDC(SourceDC);
15   Bhandle:=CreateCompatibleBitmap(SourceDC,
16   RectWidth,RectHeight);
17   SelectObject(DestDC,Bhandle);
18   BitBlt(DestDC,0,0,RectWidth,RectHeight,SourceDC,
19   LeftPos,TopPos,SRCCOPY);
20   Bitmap:=TBitmap.Create;
21   Bitmap.Handle:=BHandle;
22   Stream := TMemoryStream.Create;
23   Bitmap.SaveToStream(Stream);
24   Stream.Free;
25   try
26     MyJpeg.Assign(Bitmap);
27     MyJpeg.CompressionQuality:=70;
28     MyJpeg.Compress;
29     MyJpeg.SaveToFile('C:\MyJPEGImage.JPG');
30   finally
31     MyJpeg.Free;
32     Bitmap.Free;
33     DeleteDC(DestDC);
34     ReleaseDC(Bhandle,SourceDC);
35   end;
36 end;