获取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解释器,直接从类文件 ...
随机推荐
- angular controller的一些用法
最近公司的项目是es6+angular.其中的代码格式还在逐步摸索中.感谢今天同事每天帮我解惑. 今天简单梳理一下controller的一些用法 之前看书所熟知的都是 这是最普通的一种 //html ...
- Oracle基础 程序包
一.程序包 程序包是一种数据库对象,它是对相关PLSQL类型.子程序.游标.异常.变量和常量的封装.程序包包含两部分内容: 1.程序包规范:可以声明类型.变量.常量.异常.游标和子程序. 2.程序包主 ...
- kettle入门(七) 之kettle增量方案(一)全量比对取增量-依据唯一标示
引: ods有个project表来自于上游系统,数据量不大 十几万,下游系统须要此数据,而且须要每天提供截止当天的增量数据 要求每条数据给出数据变化时间及标示,即数据若是插入 有插入时间和插入标示 若 ...
- PLSQL Developer设置技巧
1.右键菜单 在PL/SQL Developer(下面简称PLD)中的每一个文本编辑窗口,如SQL Window,Command Window和Porgram Window,右键点击某个对象名称,会弹 ...
- Install Erlang and Elixir in CentOS 7
In this tutorial, we will be discussing about how to install Erlang and Elixir in CentOS 7 minimal s ...
- WebLogicSSL解决苹果IOS itms下载问题
前提: 安装好openssl工具. 通过windows cmd 命令进入 openssl工作文件夹 如解压文件夹为:E:\ openssl-1.0.2-beta1 则工作文件夹为E:\openssl- ...
- Ajax分页功能的实现
电脑换了固态硬盘,准备重装系统,因此打算把项目里一直延用的代码总结出来,防止丢失,以后也方便查阅.Ajax分页已经是非常普遍的技术了,所以也没什么需要特别说明的,直接贴代码: html部分 <! ...
- [译]GLUT教程 - 键盘
Lighthouse3d.com >> GLUT Tutorial >> Input >> Keyboard GLUT可以让应用程序自动监测键盘输入,包括普通按键和 ...
- 笔试真题解析 ALBB-2015 系统project师研发笔试题
4)在小端序的机器中,假设 union X { int x; char y[4]; }; 假设 X a; a.x=0x11223344;//16进制 则:() y[0]=11 y[1] ...
- Mysql:1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'错误解决
select distinct b.sale_count from product_sale b where b.pro_id in (select a.pro_id from product a L ...