[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Fastest way to capture screen

I need a fastest way to capture a screen.

The scenario:
- I play an AVI file in screen position 0,0
- within 1 second, I will try to capture as much as possible in that screen position with size = 320x240
- Each captured image will be saved as JPG.

Currently, I am using Bitblt like this :

   DC := getDC(GetDesktopWindow);
   
   jpg.CompressionQuality := 60;
   done := FALSE;

   Timer1.Interval := 1000;
   Timer1.Enabled := TRUE;
   while not done do
   begin
      BitBlt(bmp.Canvas.Handle, 0, 0, 320, 240, DC, 0, 0, SRCOPY);
      jpg.Assign(bmp);
      jpg.SaveToFile('capture'+IntToStr(ctr)+'.jpg');
      Inc(ctr);
      Application.ProcessMessage;
   end;

   ReleaseDC(DC, DC);

Using Pentium 4 2.0 GHz, I can capture about 53 files.

But I need to optimize this code. Is it possible?

0
kapot
Asked:
kapot
2 Solutions
 
GloomyFriarCommented:
I'm not shure, but I think that using DirectX will be faster.
0
 
gmayoCommented:
Using JPG will slow it down (compression algorithms take time). Using BMP will use up more disk space and may take longer to write to disk. Try a different format (BMP, GIF, etc) and see whether it is any quicker.

Geoff M.
0
 
LeVuHoangCommented:
does anybody know a sample to copy screen using DirectX by Delphi ???
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
ZolikaPCommented:
try to capture not the hole screen, just the range that is usefull for you...
put all pictures in a stream in your own format, and make pictures after you've finished the capture.

regards,
  Zoltan.
0
 
ZolikaPCommented:
0
 
LeVuHoangCommented:
anybody can give me a delphi sample to capture screen using DirectX ?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now