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. python实现将文件夹内所有txt文件合并成一个文件

    新建一个文件夹命名为yuliao,把所有txt文件放进去就ok啦!注意路径中‘/’,windows下路径不是这样. #coding=utf-8  import os #获取目标文件夹的路径 filed ...

  2. Java基础- super 和 this 解析

    1. superkeyword表示超(父)类的意思.this变量代表对象本身. 2. super訪问父类被子类隐藏的变量或覆盖的方法.当前类假设是从超类继承而来的,当调用super.XX()就是调用基 ...

  3. 倍福TwinCAT(贝福Beckhoff)基础教程5.1 TwinCAT如何执行系统命令

    TwinCAT提供了一系列的执行Windows系统命令的方法 Name 描述 NT_Shutdown 关机操作系统 NT_AbortShutdown 取消关机操作系统命令 NT_Reboot 重启操作 ...

  4. iOS开发--Mac下server搭建

    前言 对于Mac电脑的认识.我一直停留在装B神器的意识上.就在前两天我彻底改变了庸俗的看法,当时忙着写毕业设计.苦于iOS开发没有server, 数据都是从网上抓取或本地plist文件,感觉不够高大上 ...

  5. Efficiently traversing InnoDB B+Trees with the page directory--slot

    Efficientlytraversing InnoDB B+Trees with the page directory 1.the purpose of the page directory As ...

  6. Tomcat Connector的三种不同的运行模式

    Tomcat Connector的三种不同的运行模式性能相差很大,有人测试过的结果如下: 这三种模式的不同之处如下: BIO: 一个线程处理一个请求.缺点:并发量高时,线程数较多,浪费资源. Tomc ...

  7. Android学习(十六) 通过GestureDetector进行手势识别

    一.手势交互过程: 1)触屏时,触发MotionEvent事件. 2)被OnTouchListener监听,在onTouch()中获得MotionEvent对象. 3)GestureDetector转 ...

  8. C. Glass Carving (CF Round #296 (Div. 2) STL--set的运用 && 并查集方法)

    C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  9. iOS项目开发之仿网易彩票推荐应用

    简介 效果展示 思路分析 代码实现 Git地址 一.简介 某些公司有较多的产品时,通常会在一个产品中推广另外的一些产品,我简单的封装了一个UIControllerView,由于不同公司,要求不同.所以 ...

  10. DPM(Deformable Part Model)原理详解(汇总)

    写在前面: DPM(Deformable Part Model),正如其名称所述,可变形的组件模型,是一种基于组件的检测算法,其所见即其意.该模型由大神Felzenszwalb在2008年提出,并发表 ...