0

I want to make a standalone application which can capture the screen run-time and display it on an external monitor. I know simply duplicating the monitor works but I am interested in making an app for it.

I went through various forum questions for a solution and was inclined on doing it the DirectX way. But turns out that DirectX way can only capture the screen of an app running through d3d. It is not possible to create a standalone screencapturer using DirectX.

Correct me if I am wrong. I made this conclusion based on the question asked here

It was suggested to do so using DXGI approach in the same thread.

Please help me out here.

I mention it again that I want to create a standalone screenrecording application which casts the content running on the main desktop onto an external monitor.

I am new to DirectX programming so I don't know about the intricacies involved. Any amount of advice on creating the best (fastest) standalone screen capture application is appreciated.

newbie2015
  • 581
  • 5
  • 29

1 Answers1

1

Actually DirectX can capture not only the window painted by d3d but whole screen like this: https://i.stack.imgur.com/NRmQP.jpg

I just finished this program yesterday :P

On my computer, using gdi+ (Bitblt) costs about 60ms to take a 1080p screenshot but only 9ms to take screenshot and render a frame by DirectX (IDXGIOutputDuplication).

This is the fastest way I had tried, but sadly it seems that only works on Windows 8 (I can't run this program on my Windows 7 machine).

You can check the information from here: https://msdn.microsoft.com/en-us/library/windows/desktop/hh404487

And there are some sample code in that article.

kk57
  • 26
  • 3
  • But it is possible for the previous versions of Windows right? Using GetFrontBufferData? I saw a few answers on StackOverFlow which stated that this can be achieved using GetFrontBufferData. – newbie2015 Jul 05 '15 at 06:33
  • 1
    Oh, you reminded me of I had tried DirectX 9 with GetFrontBufferData. On my machine it costs 48-50ms to take a screenshot, not really that fast. I got the sample on this web: http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen – kk57 Jul 05 '15 at 07:16
  • Ohh okay. But for a windows7 or lower is there any other faster way than GetFrontBufferData? I tried using OpenGL. But it captures only OpenGL rendered objects. It cant capture Desktop or other applications. – newbie2015 Jul 05 '15 at 08:08
  • Sadly I don't know more of them ): But if you don't have take all full screen, gdi+ (bitblt) can let you choose the region you want to capture. It costs 50% off when I capture quarter size (half of width and height) – kk57 Jul 05 '15 at 10:16
  • You mentioned you have achieved taking screenshots using GetFrontBufferData(). I tried that and it works fine for every other application. But returns a black image for full screen games. [Here](http://stackoverflow.com/q/31286503/4794952) is a link to my problem in detail. Can you help me out with the code snippet you used for capturing the screen. – newbie2015 Jul 09 '15 at 12:10