How to take a screenshot of a window by handle in Delphi

It's very simple. Just drop TScreenshot component onto your form, set Source to ssWindow, assign WindowHandle ptoperty and call Snap method.

with Screenshot do
begin
  Source:=ssWindow;
  WindowHandle:=251765;
  if Snap then ImageShot.Picture.Assign(Screenshot);
end;
See also
Screenshot
Components for Delphi / C++ Builder
Howtos for Programmers