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输出的更多相关文章

  1. 获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)

    Type   TFileVersionInfo   =   Record         FixedInfo:TVSFixedFileInfo;         {版本信息}         Comp ...

  2. bat 获取 exe 文件中 产品版本号并存储到变量中

    set EXE='D:\gitlab\drivereasy3\DriverEasyWPF\bin\Release\DriverEasy.exe' powershell "(Get-Item ...

  3. Python获取exe文件版本

    import time, datetime, re, subprocess, sys, os, win32net, win32api, win32con, win32netcon, win32secu ...

  4. 将memo转化为JPG输出,使用Memo1.PaintTo(Bitmap.Canvas)

    unit unit1; interface uses  Windows, Messages, SysUtils, Graphics, Controls, Forms, StdCtrls,  Class ...

  5. 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 ...

  6. Windows定位窗口对应的exe文件

    一.说明 以下两种情况我们会想要定位窗口是由哪个exe文件,或者什么命令启用 第一种是:广告窗口,现在经常时不时冒出一个广告窗口,要么是完全看不出哪个程序启动,要么是虽然大概知道是哪个应用启动(比如w ...

  7. 怎样在windows下和linux下获取文件(如exe文件)的具体信息和属性

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/xmt1139057136/article/details/25620685 程序猿都非常懒.你懂的! ...

  8. 运用 pyinstaller 打包的python exe文件运行 去掉命令行窗口及其他参数汇总

    运行exe文件的时候,会弹出一个dos命令窗口,这个窗口可以看到一些打印信息,如果想只运行tkinter 页面,去掉dos窗口需要在打包的时候 加上 -w 参数 pyinstaller -F XX.p ...

  9. JDK/bin目录下的不同exe文件的用途(转)

    新安装完JDk 大家是否发现安装目录的bin文件夹有很多exe文件 下面就为大家讲解不同exe文件的用途 javac:Java编译器,将Java源代码换成字节代 java:Java解释器,直接从类文件 ...

随机推荐

  1. 转: 苹果APNS的说明

    转: http://toutiao.com/a6276578687162040578/?tt_from=weixin&utm_campaign=client_share&app=new ...

  2. centos 7 查看系统/硬件信息及运维常用命令+联想Y430P无线网卡驱动安装

     centos 7 查看系统/硬件信息及运维常用命令 当前环境:联想Y430P  CentOS 7.3 [root@yan-001 ~] # uname -a # 查看内核/操作系统/CPU信息的Li ...

  3. vue-router 嵌套路由

    const router = new VueRouter({ routes: [ { path: '/user/:id', component: User, children: [ { // 当 /u ...

  4. Oracle 11g 递归+ exists运行计划的改变

    有一个递归查询在10g上执行非常快,但在11g上执行不出来. SQL> select * from v$version; BANNER ----------------------------- ...

  5. Nginx:事件模块

    参考资料<深入理解Nginx> 根据不同的系统内核,Nginx会使用不同的事件驱动机制,本次描述的场景是使用epoll来驱动事件的处理. epoll的使用方法 1.int epoll_cr ...

  6. TELNET模拟HTTP请求

    开启nginx服务,查看服务器地址(192.168.11.119) 使用telnet命令连接服务器的80端口 http协议报文格式 1.request 2.response 输入请求行: GET / ...

  7. MySQL - Show Processlist 整理(转)

      原文来源:MySQL 5.5 Reference Manual 部分翻译取自:<MySQL_5.1中文参考手册> 转载请注明原文链接http://www.cnblogs.com/len ...

  8. ios侧滑返回:完美解决 interactivePopGestureRecognizer 卡住的问题

    interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊(比如在rootViewcontroller下 ...

  9. Python Windows文件操作

    获得目录和文件名 os.getenv()获取环境变量 os.putenv()设置环境变量 os.getcwd() 获得当前目录 os.chdir(‘要设置的当前目录’) os.listdir() 返回 ...

  10. smarty、smarty格式化、smarty整数、smarty float、smarty各种转换方式、smarty日期转换等等 (转)

    <? require("setup.php"); define('PAGETITLE','pagtitle'); function insert_top($lid,$sid) ...