Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7936625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:16:19+00:00 2026-06-03T22:16:19+00:00

I was reading this arcile: http://www.ring3circus.com/gameprogramming/case-study-fraps/ and I’ve come to realize that given how

  • 0

I was reading this arcile:
http://www.ring3circus.com/gameprogramming/case-study-fraps/
and I’ve come to realize that given how old it is, (and the author even suggests against using his code), that this really isn’t going to suite my needs (one, it’s C#, two, it’s for DX9). I am trying to get a rectangle capture of a DirectX game window and have it in memory as some sort of streaming video that I can reference. The window needs to be able to still be captured if not in foreground, or even visible (buried behind other windows). I have tried that C# library (the one made with EasyHook and SlimDX), but I’ve only managed to get the demo to work successfully once with a DirectX 11 game under 64bit (been unable to reproduce it since). Even then, the capture rate was eye-bleedingly slow. Along with a lot of other things that covered overlaying to DirectX (which I don’t need). I’d like to mimic what fraps does as far as capture goes, but I just need a rectangle area of the game, not the whole thing, and I don’t need to write it to a file. Could I perhaps get a code sample of how I’d manage to get a fast frame capture of a given rectangle of the game window, in C#, that works for DX9 trough DX11?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:16:20+00:00Added an answer on June 3, 2026 at 10:16 pm

    Here is my C++ code for the same problem.

    ID3D11Texture2D* pSurface;
    HRESULT hr = m_swapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast< void** >( &pSurface ) );
    if( pSurface )
    {
        const int width = static_cast<int>(m_window->Bounds.Width * m_dpi / 96.0f);
        const int height = static_cast<int>(m_window->Bounds.Height * m_dpi / 96.0f);
        unsigned int size = width * height;
        if( m_captureData )
        {
            freeFramebufferData( m_captureData );
        }
        m_captureData = new unsigned char[ width * height * 4 ];
    
        ID3D11Texture2D* pNewTexture = NULL;
    
        D3D11_TEXTURE2D_DESC description;
        pSurface->GetDesc( &description );
        description.BindFlags = 0;
        description.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
        description.Usage = D3D11_USAGE_STAGING;
    
        HRESULT hr = m_d3dDevice->CreateTexture2D( &description, NULL, &pNewTexture );
        if( pNewTexture )
        {
            m_d3dContext->CopyResource( pNewTexture, pSurface );
            D3D11_MAPPED_SUBRESOURCE resource;
            unsigned int subresource = D3D11CalcSubresource( 0, 0, 0 );
            HRESULT hr = m_d3dContext->Map( pNewTexture, subresource, D3D11_MAP_READ_WRITE, 0, &resource );
            //resource.pData; // TEXTURE DATA IS HERE
    
            const int pitch = width << 2;
            const unsigned char* source = static_cast< const unsigned char* >( resource.pData );
            unsigned char* dest = m_captureData;
            for( int i = 0; i < height; ++i )
            {
                memcpy( dest, source, width * 4 );
                source += pitch;
                dest += pitch;
            }
    
            m_captureSize = size;
            m_captureWidth = width;
            m_captureHeight = height;
    
            return;
        }
    
        freeFramebufferData( m_captureData );
    }
    

    You /might/ be able to port this to C#, or at least wrap it in a library. I asked a similar question, but then found the answer: DirectX 11 framebuffer capture (C++, no Win32 or D3DX)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading this article http://support.microsoft.com/kb/813878 I have a question: Where can I get ipseccmd.exe for
After reading this article on thedailywtf.com, I'm not sure that I really got the
Reading this page http://code.google.com/p/closure-stylesheets/ , I can't seem to find any documentation explaining how
Reading this article Taking Advantage of High-Definition Mouse Movement - http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864(v=vs.100).aspx , I surmise
Im reading this page http://www.scala-lang.org/node/137 , I understand what covariance is and lower bounds
After reading this question I attempted to clean out my workspace and found that
After reading this question , I've learned that denormalization is not a solution for
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
While reading this article, I got a doubt. I understood that while trasferring small
While reading this SO post - Is there a version of JavaScript's String.indexOf() that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.