Taking a screen shot of a window using Delphi code are rather easy.
A screen shot (screen capture) is a copy of the screen's contents that can being saved as a graphics file or displayed in a G Raphics "aware" control, for example Timage.
In most cases you'll want a screen shot of the active window or the Windows Desktop.
What if your need to does a screen capture of all the running applications-most of them would be inactive and not visible to The user?
Windowsnap-inactive Window Screen Captureadsdelphi globalization Toolwww.tsilang.comGlobalize your Delphi applications Easy, professionally and fast! Image Library for Delphiwww.imageen.comCreate Professional multimedia and photo apps with Delphi and Imageenxlsreadwriteii For Delphiwww.axolot.comNative VCL component for reading & writing Excel files with delphi/c++
- Api
- Net components
- Open API Management
- Delphi
- Screen Capture Windows
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:
usesWindows;//if not already used functionWindowsnap (Windowhandle:hwnd; bmp:tbitmap): Boolean;varR:trect; User32dllhandle:thandle; PRINTWINDOWAPI:function(Sourcehandle:hwnd; destinationhandle:hdc; nflags:uint): BOOL;stdcall;beginResult: = False; User32dllhandle: = GetModuleHandle (USER32);ifUser32dllhandle <> 0 Thenbegin@printWindowAPI: = GetProcAddress (User32dllhandle, ' Printwindow ');if@printWindowAPI <>Nil ThenbeginGetWindowRect (WindowHandle, R); Bmp. Width: = R.right-r.left; Bmp. Height: = R.bottom-r.top; Bmp. Canvas.lock;TryResult: = Printwindowapi (WindowHandle, BMP. Canvas.handle, 0);finallyBmp. Canvas.unlock;end;end;end; end; (*windowsnap*)
adsc# Tutorial for Beginnerswww.eurekalearn.netLearn C # quickly and easily. Download your free eBook now. Fastest VPN for chinaexpressvpn.comunblock any Site. Try it Risk free. 256-bit SSL. High Speed guaranteed!
Note that the first parameter to the WINDOWSNAP procedure was a HWND value (thandle)-The handle of the window you want to Capture.
Windowse is a extremely convenient and easy to use tool for obtaining necessary technical information on any window (h Andle, 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 are rather easy.