获取exe文件窗口抓图,将memo转化为JPG输出
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Data.DB, Data.Win.ADODB;
type
TForm1 = class(TForm)
Button1: TButton;
ADOTable1: TADOTable;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function PrintWindow(SourceWindow: hwnd; Destination: hdc; nFlags: cardinal): bool; stdcall; external 'user32.dll' name 'PrintWindow';
procedure TForm1.Button1Click(Sender: TObject);
var
bmp: TBitmap;
wnd: cardinal;
rec: TRect;
begin
wnd := FindWindow(nil, 'Calculatrice'); // 查找窗口句柄,这里用计算器演示
GetWindowRect(wnd, rec); // 获取到计算器窗口的举行
bmp := TBitmap.Create;
try
bmp.Width := rec.Right - rec.Left;
bmp.Height := rec.Bottom - rec.Top;
bmp.PixelFormat := pf24bit;
PrintWindow(wnd, bmp.Canvas.Handle, 0);
bmp.SaveToFile('c:\cc.bmp');
finally
bmp.Free;
end;
end;
end.
http://www.cnblogs.com/wxy8/archive/2011/01/24/1943045.html
unit unit1;
interface
uses
Windows, Messages, SysUtils, Graphics, Controls, Forms, StdCtrls,
Classes;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses jpeg;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
vBitmap: TBitmap;
vJpegImage: TJpegImage;
vOldHeight: Integer;
begin
Canvas.Font.Assign(Memo1.Font);
vOldHeight := Memo1.Height;
Memo1.ClientHeight := Canvas.TextHeight('|') * Memo1.Lines.Count + 2;
vBitmap := TBitmap.Create;
vJpegImage := TJpegImage.Create;
try
vBitmap.Height := Memo1.ClientHeight;
vBitmap.Width := Memo1.ClientWidth;
Memo1.PaintTo(vBitmap.Canvas, -2, -2);
vJpegImage.Assign(vBitmap);
vJpegImage.CompressionQuality := 75;
vJpegImage.Compress;
vJpegImage.SaveToFile('输出.jpg');
// Image1.Picture.Graphic := vJpegImage;
finally
vBitmap.Free;
Memo1.Height := vOldHeight;
end;
end;
http://www.cnblogs.com/wxy8/archive/2011/01/13/1934477.html
获取exe文件窗口抓图,将memo转化为JPG输出的更多相关文章
- 获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)
Type TFileVersionInfo = Record FixedInfo:TVSFixedFileInfo; {版本信息} Comp ...
- bat 获取 exe 文件中 产品版本号并存储到变量中
set EXE='D:\gitlab\drivereasy3\DriverEasyWPF\bin\Release\DriverEasy.exe' powershell "(Get-Item ...
- Python获取exe文件版本
import time, datetime, re, subprocess, sys, os, win32net, win32api, win32con, win32netcon, win32secu ...
- 将memo转化为JPG输出,使用Memo1.PaintTo(Bitmap.Canvas)
unit unit1; interface uses Windows, Messages, SysUtils, Graphics, Controls, Forms, StdCtrls, Class ...
- Visual Studio 2017 - Windows应用程序打包成exe文件(2)- Advanced Installer 关于Newtonsoft.Json,LINQ to JSON的一个小demo mysql循环插入数据、生成随机数及CONCAT函数 .NET记录-获取外网IP以及判断该IP是属于网通还是电信 Guid的生成和数据修整(去除空格和小写字符)
Visual Studio 2017 - Windows应用程序打包成exe文件(2)- Advanced Installer Advanced Installer :Free for 30 da ...
- Windows定位窗口对应的exe文件
一.说明 以下两种情况我们会想要定位窗口是由哪个exe文件,或者什么命令启用 第一种是:广告窗口,现在经常时不时冒出一个广告窗口,要么是完全看不出哪个程序启动,要么是虽然大概知道是哪个应用启动(比如w ...
- 怎样在windows下和linux下获取文件(如exe文件)的具体信息和属性
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/xmt1139057136/article/details/25620685 程序猿都非常懒.你懂的! ...
- 运用 pyinstaller 打包的python exe文件运行 去掉命令行窗口及其他参数汇总
运行exe文件的时候,会弹出一个dos命令窗口,这个窗口可以看到一些打印信息,如果想只运行tkinter 页面,去掉dos窗口需要在打包的时候 加上 -w 参数 pyinstaller -F XX.p ...
- JDK/bin目录下的不同exe文件的用途(转)
新安装完JDk 大家是否发现安装目录的bin文件夹有很多exe文件 下面就为大家讲解不同exe文件的用途 javac:Java编译器,将Java源代码换成字节代 java:Java解释器,直接从类文件 ...
随机推荐
- C#.NET为List加入扩展方法:获取唯一值
public static class ListTools { /// <summary> /// 获取唯一值列表 /// </summary> /// <param n ...
- 在html页面中直接嵌入图片数据
一般情况,通常是在html页面中应用图片的链接,如: <img src="http://baidu.com/logo.gif"> 但是,这样的前提是我们需要将图片先 ...
- 批量扫描IP端口程序 (适用于window&linux)
批量扫描IP端口,根据扫描IP导出IP命名的文件的结果.假设1.txt文件内容为127.0.0.1192.168.1.1然后我们获取文件内容IP进行扫描window .bat版本 :1.txt为文件名 ...
- jQuery 事件 - delegate() 方法
<html><head><script type="text/javascript" src="/jquery/jquery.js" ...
- Maven - error in opening zip file
在一个maven工程中,有时执行mvn打包,部署,编译等命令,例如mvn clean install -DskipTests -U等命令时,会报类似(error in opening zip file ...
- NHibernate利用Mindscape.NHibernateModelDesigner实现数据库与实体之间的转换及操作
环境:   Visual Studio 2010 一.Mindscape.NhibernateModelDesigner安装   在打开 ...
- .net 定时服务
namespace MvcApplication1 { public class MvcApplication : System.Web.HttpApplication { protected voi ...
- C#中的隐藏方法
在C#中要重写基类的方法,C#提倡在基类中使用virtual来标记要被重写的方法,在子类也就是派生类中用voerride关键字来修饰重写的方法. 如果要是项目中前期考虑不足,我没有在基类(ClassA ...
- ASP.NET CORE RAZOR :初始化数据库
官方说法是:设定数据库种子https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/razor-pages/sql 应用背景:初次部署系统时,设定一 ...
- SpringBoot使用MyBatis报错:Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseInsertProvider.dynamicSQL)
© 版权声明:本文为博主原创文章,转载请注明出处 1. 错误描述 使用SpringBoot集成MyBatis框架,并且使用 mapper-spring-boot-starter 自动生成MyBati ...