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 ...
随机推荐
- Zookeeper实战
这里的实战主要是用Java API对Zookeeper进行相应的操作,来实现我们的业务需求.首先简单地测试一下Zookeeper节点的增删改查操作,然后测试两个例子,分别是分布式应用HA以及分布式锁. ...
- mysql—触发器trigger
触发器(trigger):一种特殊的事物, 监视某种事物操作(insert/update/delete), 并触发相关操作(insert/update/delete). 触发器(trigger)创建4 ...
- Java异常框架设计
什么是异常? 异常(exception)应该是异常事件(exceptional event)的缩写.异常定义:异常是一个在程序执行期间发生的事件,它中断正在执行的程序的正常的指令流.当在一个方法中发生 ...
- ubuntu14.04安装vmware workstation
0) Do the basic system installation of Ubuntu 14.04 LTS (Server or Desktop) 1) wget the installer wg ...
- 【python】模块测试 if name main
verbose=1 def listing(module): if verbose: print '-'*30 print 'name:',module.__name__,'file:',module ...
- Java中带包的类的编译与执行
http://blog.csdn.net/wbrs13/article/details/4859880
- java获取系统时区
//Calendar cal = Calendar.getInstance(); //TimeZone timeZone = cal.getTimeZone(); TimeZone timeZone ...
- 好久没写blog了 ~ 换了个城市,换了个公司,各种忙碌
最近一直在忙工作交接以及换城市.入职的事情 ~~~ 新公司做C++的比较少,so全上C++11了,写代码各种爽. 最近应该会写一点关于QT的blog , 学到新知识了哈.
- 认识tornado(四)
接下来我们看一下helloword.py的唯一一个handler. 1 class MainHandler(tornado.web.RequestHandler): 2 def get(self): ...
- Kotlin教程——史上最全面、最详细的学习教程,持续更新中....
关于这个系列教程,我是从最基础的开发环境搭建到项目进阶到后面的项目开发这个过程来写的.我一直秉承从实际项目开发以及源码解析的角度去写好这个教程,并让从未接触过编程的朋友能学好kotlin这门语言.所以 ...