Jump to content

make a screenshot


mmurgas

Recommended Posts

Hello, I'm trying to make a screenshot of an area of my application (map) and leave it in a directory on the server, it works correctly in my local environment (localhost), but when I go to the actual server ... as I can make it work there? show the code.
 
Greetings and thanks in advance
 
mmurgas
 
procedure capturar_area_pantalla_a_bitmap_temporal(ABitmap: TBitmap);
var
  vDesktopDC: HDC; //contendrá el device context handle del escritorio actual
begin
  vDesktopDC := GetWindowDC(GetDesktopWindow);
  try
      ABitmap.PixelFormat := pf24bit;
      ABitmap.Height := Screen.Height;
      ABitmap.Width := Screen.Width;
      BitBlt(ABitmap.Canvas.Handle, 0, 0, ABitmap.Width, ABitmap.Height, vDesktopDC, 0, 0, SRCCOPY); 
  finally
    ReleaseDC(GetDesktopWindow, vDesktopDC);
  end;
end;

procedure capturar_pantalla_a_disco_formato_JPG(const fichero:string);
var
  vJpg: TJpegImage;
  vBmp: TBitmap;
begin
  vBmp := TBitmap.Create;
  try
    capturar_area_pantalla_a_bitmap_temporal(vBmp);
    vJpg := TJpegImage.Create;
    try
      vJpg.Assign(vBmp);
      vJpg.CompressionQuality := 85; //calidad JPG 85%
      vJpg.SaveToFile(fichero); //save format JPG
    finally
      vJpg.Free;
    end;
  finally
    vBmp.Free;
  end;
end;

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...