Some media players use hardware acceleration for output (for example Windows Media Player and vlc). It is impossible to take a screenshot with Print Screen, the video will show up black on the captured bitmap. I have tried to capture via DirectDraw - create primary interface, lock it, copy data, and write to bitmap. Capture still turned out to be black :(
Shouldn't locking primary surface give me access to actual video memory?
Posted on 2004-02-25 22:08:04 by comrade
In previous versions of DirectX, we might have locked the primary surface and read the pixel data from the frame buffer. However, as of the release of DirectX 8, direct access to the primary surface memory is no longer available. Instead, the GetFrontBuffer() provides a facility to retrieve the contents of the frame buffer to an image surface in system memory. Format conversion is automatically performed, converting from the current display format to a fixed format of A8R8G8B8.

http://www.mvps.org/directx/articles/screengrab.htm

Have a nice day :)

Say, it just occurred to me that I can use this myself to "render to a surface" without the associated specialized render code - this would allow me to (for example) copy the "Pause Menu" to a surface, and then apply it to a textured quad, then when the user unpauses / returns to game, "throw" the quad in Z as a cute transition/wipe effect :)
Posted on 2004-02-25 22:41:44 by Homer
i think media player and vlc use overlay surface, you cannot capture overlay screen from primary surface...
Posted on 2004-02-26 06:28:09 by kamilh
Yes, they do use overlay surface. What can I do?
Posted on 2004-02-26 07:16:56 by comrade
EvilHomer2k, that does not help. I am not using new DirectX, but rather old ddraw interface. This same idea, but different implementation.
Posted on 2004-02-26 07:25:57 by comrade
I figured if you are instancing DX7 from >DX8 runtimes that the issue would be relevant to you, although m$ claim backward compatibility, we all know what they say and what they mean can be mutually exclusive :tongue:
Posted on 2004-02-26 09:03:56 by Homer
Howdy, comrade! I googled around a bit, and it seems that even screen grabber software writers have problems with grabbing overlay images :)

At least two different programs mentioned similar methods: "turn on DirectX screen grabbing and be sure the window you want to grab from is foreground" - so it would seem that you need the HWND of the app to grab. Perhaps this means you have to do code injection, perhaps there's some DX/Overlay stuff you can call with the HWND. Does seem like there's some work to this...

If you just need some application to do this, http://www.creativesoftworx.com/ might work. Or you might have a look at the imports of the program to see if there's any hints.

The search terms I was using didn't give anything more substantial in the first four pages or so.

Homer, isn't this problem only relevant if you use DX interfaces > 7? Using DX7 interface with DX8 installed should still allow you to lock the primary surface, shouldn't it? (And this still wouldn't give access to overlays anyway).
Posted on 2004-02-26 09:16:28 by f0dder
Thanks
Posted on 2004-02-26 17:27:41 by comrade
This tool claims to do what you want, so atleast it is possible.:)
Posted on 2004-02-26 23:22:10 by bitRAKE