Take Screenshot of Application Form

Hi all,

I need to take a screenshot a my active application form and save it to jpg with a specific image size (width and height).

Does anyone know how to do this plase?
Who is Participating?
CynnaConnect With a Mentor Commented:
This function will save any active window to specifiyed jpg file. Please read the comments, then copy/paste and use.

function SaveActiveWin(FileName: String; const ImgWidth: Integer=0; const ImgHeight: Integer=0): Boolean;
// NOTE: if ImgWidth and ImgHeight are not used in function call, window is saved with original dimensions
var s, d: TRect;
    c: TCanvas;
    h: THandle;
    b: TBitMap;
    j: TJPegImage; // Add "jpeg" to uses list
  if LowerCase(ExtractFileExt(FileName))<>'.jpg' then FileName:=FileName+'.jpg';
  Result:=FALSE; h := GetForeGroundWindow; if h = 0 then Exit;
  c := TCanvas.Create;  b:=TBitmap.Create; j := TJPegImage.Create;
  c.Handle := GetWindowDC(GetDesktopWindow);
    GetWindowRect(h, s);
    if (ImgWidth=0) or (ImgHeight=0) then
       d := Rect(0, 0, s.Right - s.Left, s.Bottom - s.Top)
       d := Rect(0, 0, ImgWidth, ImgHeight);
    with b do begin
         Width  := d.Right - d.Left;
         Height := d.Bottom - d.Top;
         PixelFormat := pf24bit;
         Canvas.CopyRect(d, c, s);
    with j do begin
         Assign(b); SaveToFile(FileName);
    ReleaseDC(0, c.Handle);
    c.Free; b.Free; j.Free;
Peter HartCommented:
I use an application called paintshop pro it has a built in feature to take snapshots from the screen.
but try the following:

1 Set up your computer to display the screen that you want to capture. For example, if you want to take a picture of your Web site, open your home page in the browser that you normally use.
2 Press the Print Screen button on your keyboard. This captures a "snapshot" on the Clipboard.
3 Open a graphics program.
4Open a new file.
5Paste the contents of the Clipboard into your document (Control+V).
6Your file now contains an image of the screen that you captured. Name your file and save it in the graphics format of your choice.
Peter HartCommented:
sorry that should read "press  ALT key plus "print screen" button on the keyboard
ST3VOAuthor Commented:
Thanks a Million :o)

Works Perfect!!!



You are welcome ;)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.