Taking a screen shot of a window using Delphi code is rather easy.
Taking a screen shot of a window using Delphi code is rather easy.
A screen shot (screen capture) is a copy of the screen's contents that
can be saved as a graphics file or displayed in a graphics "aware" control, for
example TImage.
In most cases you will want to take a screen shot of the active window or the
Windows Desktop.
What if you need to do a screen capture of all the running applications -
most of them will be inactive and not visible to the user?
WindowSnap - Inactive Window Screen Capture
and fast!
Delphi and ImageEn
files with Delphi/C++
Windows XP also introduces
the new printing API, PrintWindow. This API enables the caller to snapshot a
visual copy of a window into a device context.
Drop a TImage (named "Image1") on a form and use the following code:
The actual WindowSnap function is defined as:
uses Windows; //if not already used
function WindowSnap(windowHandle: HWND; bmp: TBitmap): boolean; var r: TRect; user32DLLHandle: THandle; printWindowAPI: function(sourceHandle: HWND; destinationHandle: HDC; nFlags: UINT): BOOL; stdcall; begin result := False; user32DLLHandle := GetModuleHandle(user32) ; if user32DLLHandle <> 0 then begin @printWindowAPI := GetProcAddress(user32DLLHandle, 'PrintWindow') ; if @printWindowAPI <> nil then begin GetWindowRect(windowHandle, r) ; bmp.Width := r.Right - r.Left; bmp.Height := r.Bottom - r.Top; bmp.Canvas.Lock; try result := printWindowAPI(windowHandle, bmp.Canvas.Handle, 0) ; finally bmp.Canvas.Unlock; end; end; end; end; (*WindowSnap*)
Note that the first parameter to the WindowSnap procedure is a HWND value (THandle) - the handle of the window you want to capture.
WinDowse is an extremely convenient and easy to use tool for obtaining necessary technical information about any window (handle, child windows, etc.)
Here's an idea: enumerate top-level windows (to grab their handles) and create your own task-switcher :)
Taking a screen shot of a window using Delphi code is rather easy.的更多相关文章
- Capture a Screen Shot
using System; using System.Runtime.InteropServices; using System.Drawing; using System.Drawing.Imagi ...
- Delphi Screen.DataModuleCount 总是返回 0!Delphi 的 Bug? DataModuleCount = 0
今天遇到一个很隐蔽的 Delphi 问题,不知做了什么,有一个功能总是不能使用,后来跟踪以下发现是因为 Screen.DataModuleCount 总是返回 0,而程序中一个函数正好要用到 ...
- [Windows Server]Windows Server turn off screen auto-lock to fit scheduled tasks(Error Code :0x4F7) / 关闭Windows Server的自动锁定来解决计划任务0x4F7错误
1. 打开“运行”,输入“regedit” 并回车. 2. 找到以下注册表路径,将Attributes的值改为 2: (原为1 HKEY_LOCAL_MACHINE \SYSTEM \CurrentC ...
- [GE]手动截取当前活动窗口,并且按规则命名(1/2)
Function Take-ScreenShot { <# .SYNOPSIS Used to take a screenshot of the desktop or the active wi ...
- [APAC]手动截取当前活动窗口,并且按规则命名(1/2)
Function Take-ScreenShot { <# .SYNOPSIS Used to take a screenshot of the desktop or the active wi ...
- Run_Product Example Form - Oracle Forms 6i
I have already posted in my previous post Running Reports Using Run_Product to run reports in Oracle ...
- Oracle Form's Trigger Tutorial With Sample FMB
Created an Oracle Form to handle specific events / triggers like When-New-Form-Instance, Pre-Insert, ...
- JS BOM基础 全局对象 window location history screen navigator
全局变量声明的两种方式:1,window.变量名=值;2,var 变量名=值; 全局函数声明的两种方式:1,window.函数名=function(){}2,function 函数名=function ...
- 屏幕的遮挡层,js得到屏幕宽高、页面宽高 (window.screen.availHeight)等--
window.screen.availWidth 返回当前屏幕宽度(空白空间) ------当手机有输入法的时候,要注意................window.screen.availHeigh ...
随机推荐
- elasticsearch插件三—— Marvel插件安装详解
2016年05月21日 22:58:13 阅读数:23058 一.Marvel插件介绍 Marvel插件:在簇中从每个节点汇集数据.这个插件必须每个节点都得安装. Marvel是Elasticsear ...
- tomcat 内存溢出原因分析及解决
一.错误提示:java.lang.OutOfMemoryError: Java heap space [原因分析] tomcat默认可以使用内存为128MB,在较大型的应用项目中不足以满足运行要求,在 ...
- Java 设计模式01 - 简单工厂模式
先要学习设计模式之前的先看看一些基础 UML类图简单说明 可以先看看我的这篇博客: UML类图简单说明,学习编程思路的必会技能 接下来才是重点,开始我们的旅程吧. 一.UML类图展示 我们要用简单工厂 ...
- pycharm重置设置,恢复默认设置
备忘,备忘,备忘 window 系统 找到下方目录-->删除. 再重新打开pycharm # Windows Vista, 7, 8, 10: <SYSTEM DRIVE>\User ...
- 简述基于Struts框架Web应用的工作流程
简述基于Struts框架Web应用的工作流程 解答:在web应用启动时就会加载初始化ActionServlet,ActionServlet从struts-config.xml文件中读取配置信息,把它们 ...
- Hadoop2的HA安装(high availability):nfs+zookeeper
前面介绍过hadoop的简单安装和FA安装,在这里将介绍几种hadoop2中HA(高可用性)安装,HA技术使hadoop不再存在单点namenode的故障. 先来第一种:nfs+zookeeper H ...
- caffe 网络参数设置
weight_decay防止过拟合的参数,使用方式: 样本越多,该值越小 模型参数越多,该值越大 一般建议值: weight_decay: 0.0005 lr_mult, decay_mult 关于偏 ...
- ios 时间解析 差8个小时
啥问题也有:小程序中web开发工具里显示时间正常,ios上显示的查8小时 原因: 使用 NSDate *date = [NSDate date]; 获取的时间是标注的UTC时间,和北京时间相差8小时. ...
- boost::bind 详解
使用 boost::bind是标准库函数std::bind1st和std::bind2nd的一种泛化形式.其可以支持函数对象.函数.函数指针.成员函数指针,并且绑定任意参数到某个指定值上或者将输入参数 ...
- MD5-【验签】
MD5是什么? MD5是message-digest algorithm 5(信息-摘要算法)的缩写,被广泛用于加密和解密技术上,它可以说是文件的"数字指纹".任何一个文件,无论是 ...