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 ...
随机推荐
- OkHttp+Stetho+Chrome调试android网络部分(原创)
android网络调试一直是一个比较麻烦的部分,因为在不同序列的请求中,返回的数据会有不同的变化,如果能像web开发一样使用调试功能查看页面的访问数据该是多么美好的事情! 很幸运的是,现在Androi ...
- Xcode模拟iPhone教程!
iOS 开发者常常会使用模拟器来进行调试,当然这就少不了Mac电脑中的Xcode软件了,今天PC6小编就给大家带来在Mac系统下如何快速启动iOS模拟器的使用教程: 一.如何启动iOS模拟器 1.在L ...
- MySql—修改权限
MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利. grant sele ...
- YARN源码分析(一)-----ApplicationMaster
转自:http://blog.csdn.net/androidlushangderen/article/details/48128955 YARN学习系列:http://blog.csdn.net/A ...
- 【爱江山越野跑】ITRA积分认证流程
背景:目前在越野跑领域,高级别的赛事有很多,比如UTMB,TDG等,而想报名参与这些赛事需要一定的积分(ITRA积分), 而这些积分的获得,需要参与获得ITRA认证的赛事,赛事难度不同,获得的积分也不 ...
- 59、常规控件(2)TextInputLayout-让EditText提示更加人性化
提示语用在显示. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andro ...
- jQuery animate() - 使用相对值 在值的前面加上 += 或 -=
也可以定义相对值(该值相对于元素的当前值).需要在值的前面加上 += 或 -=: 实例 $("button").click(function(){ $("div" ...
- python框架Scrapy中crawlSpider的使用——爬取内容写进MySQL
一.先在MySQL中创建test数据库,和相应的site数据表 二.创建Scrapy工程 #scrapy startproject 工程名 scrapy startproject demo4 三.进入 ...
- thinkphp,下载附件
ThinkPHP框架下有个Org/Net/Http.class.php的方法download. Http.class.php的download方法如下 /** * 下载文件 * 可以指定下载显示的文件 ...
- Powershell Get-registerkey(susid)
$servers=get-content D:\serverregister.txt Get-registerkey -ComputerName $servers | select computer, ...