CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2009
    Posts
    3

    Capture windowed DirectX application to bitmap

    It is possible to screencapture another direct x application using destop's DC to HBITMAP.
    But is there a way to capture from partially covered DirectX window?

  2. #2
    Join Date
    Nov 2007
    Posts
    613

    Re: Capture windowed DirectX application to bitmap

    Never tried with DirectX but I suppose it should work.

    If you mean you're trying to capture the content of a screen partially covered by your own appication, the techique is to hide your own window, perform the capture, then show your window again.

    Before performing the capture, you may need a short delay to allow DirectX to repaint the area that was covered by your window.

  3. #3
    Join Date
    Aug 2009
    Posts
    10

    Re: Capture windowed DirectX application to bitmap

    You can use this funtion:
    Code:
    HWND WindowFromPoint(Point p)
    to get the window's handle, you pass an x,y point on the screen which is also on the application you want to capture.

    Then use
    Code:
    HDC GetDC(HWND hWnd)
    to get the HDC of the window

  4. #4
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Capture windowed DirectX application to bitmap

    This may get you started on what you want to do.
    Gort...Klaatu, Barada Nikto!

  5. #5
    Join Date
    Sep 2009
    Posts
    3

    Resolved Re: Capture windowed DirectX application to bitmap

    Quote Originally Posted by Mike Harnad View Post
    This may get you started on what you want to do.
    Wow, thank you. This will really help alot!

  6. #6
    Join Date
    Sep 2009
    Posts
    3

    Re: Capture windowed DirectX application to bitmap

    The problem is to get IDirect3DSurface9 from another application.
    I'd like to know how Fraps works. I can start recording any windowed DirectX application, then change focus to another window, say, notepad. And i can move notepad so it partially or fully cover DirectX application, but Fraps still continue to record that application.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Capture windowed DirectX application to bitmap

    Read the direct memory involve. Although that could be on-board the graphics card, or else system memory. Kind of defeats the purpose of DirectX.

    I doubt you'll be able to record it, either
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured