Solved

Fastest way to capture screen

Posted on 2003-11-13
8
418 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
Industry Leaders: 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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