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

Ads

Delphi Globalization Tool

www.tsilang.com

Globalize your Delphi applications easy, professionally
and fast!

Image Library for Delphi

www.imageen.com

Create professional multimedia and photo apps with
Delphi and ImageEn

XLSReadWriteII for Delphi

www.axolot.com

Native VCL component for reading & writing Excel
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*) 

Ads

C# Tutorial for Beginners

www.eurekalearn.net

Learn C# quickly and easily. Download your Free eBook now.

Fastest VPN for China

expressvpn.com

Unblock any Site. Try it Risk Free. 256-Bit SSL. High Speed Guaranteed!

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 :)

时间: 2024-07-30 08:54:12

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.Imaging; namespace ScreenShotDemo { /// <summary> /// Provides functions to capture the entire screen, or a particular window, and save it to a file. ///

SLAM Screen Shot

[APAC]手动截取当前活动窗口,并且按规则命名(1/2)

Function Take-ScreenShot { <# .SYNOPSIS Used to take a screenshot of the desktop or the active window. .DESCRIPTION Used to take a screenshot of the desktop or the active window and save to an image file if needed. .PARAMETER screen Screenshot of the

[GE]手动截取当前活动窗口,并且按规则命名(1/2)

Function Take-ScreenShot { <# .SYNOPSIS Used to take a screenshot of the desktop or the active window. .DESCRIPTION Used to take a screenshot of the desktop or the active window and save to an image file if needed. .PARAMETER screen Screenshot of the

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 Forms 6i and in this post I am using the same procedure to run report but I am providing a demo form also. Below is the screen shot of this form and

window.screen

屏幕分辨率 确定计算机屏幕上显示多少信息的设置,以水平和垂直像素来衡量.屏幕分辨率低时(例如 640 x 480),在屏幕上显示的像素少,但尺寸比较大.屏幕分辨率高时(例如 1600 x 1200),在屏幕上显示的像素多,但尺寸比较小.显示分辨率就是屏幕上显示的像素个数,分辨率160×128的意思是水平方向含有像素数为160个,垂直方向像素数128个.屏幕尺寸一样的情况下,分辨率越高,显示效果就越精细和细腻. 1.显示器的宽高(分辨率值) window.screen.height; window

Displaying Modal Window Messages in Oracle Forms Using Show_Alert

You can display modal windows in Oracle Forms to display normal messages, error message or asking for confirmation eg. on deleting a record or saving a record etc. using show_alert command. These modal window messages can be shown using Alert option

截图工具(window 10 和Mac OSX)

  Win10上截图 1.使用系统截图工具 所有程序中可以看到 通过win+R,打开运行,输入"SnippingTool" 文件位于: C:\Windows\System32\SnippingTool.exe 优点在于可以延时截图   2.使用QQ之前的截图工具   以前QQ好像有个独立的截图工具的.现在只有从QQ拼音上提取的一个截图工具了 QQpyjp_XiaZaiBa.zip 下载后就这个文件: 但是在win10上不兼容高分屏,会出现缩放的情况. 设置下兼容性就可以使用了:   O

Mac Screen Capture Shortcuts

Here's How:   To capture the entire desktop, press Command-Shift-3. The screen shot will be automatically saved as a PNG file on your desktop. To copy the entire desktop, press Command-Control-Shift-3. The screen shot will be placed on your clipboard