Quick Screen Capture in MFC?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Quick Screen Capture in MFC?

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    8

    Quick Screen Capture in MFC?

    I've got a screen capture method that captures the screen and saves to a BMP but it seems slow. That is to say, it works fine for the first 2 screen capture events but for the next 2 it doesn't capture the updates, but rather captures the same previous image.

    Does anybody have a handy-dandy real fast screen capture to BMP method?

    Thanks in advance!

  2. #2
    Join Date
    Aug 2011
    Posts
    8

    Re: Quick Screen Capture in MFC?

    I just wanted to follow up.

    This isn't my posting, but this is exactly the same problem that I'm having:
    http://stackoverflow.com/questions/4...235308#7235308

    It appears that the code isn't slow, it's a matter of 'thread synchronization'.

    Specifically, my code looks like this:

    Invalidate(true);
    CaptureScreen(ScreenCounter);

    And the screen capture is happening before the screen is 'rebuilt' from the Invalidate.

    How do I ensure that that CaptureScreen is called only after Invalidate(true) is finished?

    Thanks!

  3. #3
    Join Date
    Sep 2012
    Posts
    2

    Re: Quick Screen Capture in MFC?

    Quote Originally Posted by zetar View Post
    I just wanted to follow up.

    This isn't my posting, but this is exactly the same problem that I'm having:
    http://stackoverflow.com/questions/4...235308#7235308

    It appears that the code isn't slow, it's a matter of 'thread synchronization'.

    Specifically, my code looks like this:

    Invalidate(true);
    CaptureScreen(ScreenCounter);

    And the screen capture is happening before the screen is 'rebuilt' from the Invalidate.

    How do I ensure that that CaptureScreen is called only after Invalidate(true) is finished?

    Thanks!
    but it seems don't work when the surface show in overlay.

  4. #4
    Join Date
    Aug 2011
    Posts
    8

    How do you know when Invalidate(true) is done?

    How do you know when Invalidate(true) is done? (yeah, I know, the screen has been updated).

    The problem that I'm having is this code:

    Invalidate(true);
    CaptureScreen(ScreenCounter);

    Unfortunately, the screen capture is happening BEFORE the screen has been updated. Is there some way that I can force a 'wait' until Invalidate(true) is done?

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,206

    Re: How do you know when Invalidate(true) is done?

    Why are you starting duplicate threads?

    Invalidate(TRUE);
    UpdateWindow();
    CaptureScreen(ScreenCounter);

  6. #6
    Join Date
    Aug 2011
    Posts
    8

    Re: How do you know when Invalidate(true) is done?

    Thanks! That worked a charm!

    Sorry about the duplicate threads. My first thread was about a screen capture, and the second was more specific.

    Again, sorry about the duplicate threads.

    Really appreciate the help.

  7. #7
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    Re: Quick Screen Capture in MFC?

    Try to call UpdateWindow after your Invalidate.

  8. #8
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    Re: Quick Screen Capture in MFC?

    [ merged threads ]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center