Solved

Fastest way to capture screen

Posted on 2003-11-13
8
417 Views
Last Modified: 2012-05-04
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
Comment
Question by:kapot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 25 total points
ID: 9740047
I'm not shure, but I think that using DirectX will be faster.
0
 
LVL 8

Expert Comment

by:gmayo
ID: 9741338
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
 

Expert Comment

by:LeVuHoang
ID: 9746028
does anybody know a sample to copy screen using DirectX by Delphi ???
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:ZolikaP
ID: 9746581
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
 
LVL 2

Assisted Solution

by:ZolikaP
ZolikaP earned 25 total points
ID: 9746609
0
 

Expert Comment

by:LeVuHoang
ID: 9753810
anybody can give me a delphi sample to capture screen using DirectX ?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question