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

Globalize your Delphi applications easy, professionally
and fast!
Create professional multimedia and photo apps with
Delphi and ImageEn
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*)
Learn C# quickly and easily. Download your Free eBook now.
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 :)

最新文章

  1. bzoj1503--treap
  2. php实现返回上一页的功能
  3. js获取键盘按下的键值event.keyCode,event.charCode,event.which的兼容性
  4. 一、MMA概述
  5. 【STL源码学习】STL算法学习之三
  6. .NET设计模式(10):装饰模式(Decorator Pattern)
  7. Windows Phone 8 应用内截图
  8. Android之Activity系列总结(一)--Activity概览
  9. [ZLXOI2015]殉国
  10. 去掉Bootstrap fileinput缩略图上面的上传删除按钮?
  11. 面试题-linux基础
  12. selenium之复选框操作
  13. easyui combobox 设置滚动条
  14. 【Codeforces 1120C】Compress String
  15. The string &quot;--&quot; is not permitted within comments【转】
  16. JDBC编程的步骤
  17. 架构师修练 I - 超级代码控
  18. Q_UNUSED() 方法的使用
  19. cin中函数的作用
  20. 创建和修改主键 (SQL)

热门文章

  1. JQ 时间插件
  2. Docker 和一个正常的虚拟机有何区别?
  3. python通过日志分析加入黑名单
  4. Html就是超文本标记语言的简写,是最基础的网页语言
  5. 【BZOJ】2021: [Usaco2010 Jan]Cheese Towers(dp)
  6. 【BZOJ】3296: [USACO2011 Open] Learning Languages(tarjan)
  7. vim 命令大全(写的非常全和好)http://blog.csdn.net/woshixiaosimao/article/details/54312738
  8. uva 10494 - If We Were a Child Again 大数除法和取余
  9. 利用python输出000至999中间的数
  10. elasticsearch.net search入门使用指南中文版