Full screen application screenshot in c++? - c++

I wish to take screenshots of fullscreen applications in a c++ program (i.e games like call of duty). I have tried using GDI and directx both can get screenshots of the desktop. However they just return black images when running fullscreen applications. Has anybody else manage to solve this problem and if so how?

Related

Overlaying text and graphics (stroked rectangles) on desktop screen

For an accessibility desktop application I must overlay the desktop screen with numbers, text and a grid of rectangles (stroked with e.g. red brush).
Ideally this should work on any window manager system (windows, linux KDE/GNOME, possibly even mac).
What is the standard approach to something like this? I was thinking of taking a screenshot of the screen and then drawing on top of it but I'm unsure on what to use to draw.
There is a library that could help you out in making cross-platform applications. glfw, this is capable of making an application window for windows, mac, Linux, and more.
For the graphics stuff, you could use OpenGL or Vulkan(personally not advised for new users) graphics APIs which are cross-platformed. I was thinking of taking a screenshot of the screen and then drawing on top of it but I'm unsure on what to use to draw. For this you could you framebuffers, learning OpenGL.

DesktopDuplicatipn API windows8 does not capture fullscreen games

I was experimenting with desktopduplication api sample code and it was mentioned here that
even full screen DirectX applications can be duplicated.
Also here it is mentioned that
The following components of the operating system can generate the desktop image:
The DWM by composing the desktop image
A full-screen DirectX or OpenGL application
An application by switching to a separate desktop, for example, the secure desktop that is used to display the login screen
However when I tested the sample code with multiple monitors provided here, it worked fine for other applications running on desktop but when I started a fullscreen directx application, the running applications in the background are pushed onto the secondary monitor and only the secondary monitor is captured in the duplicated window.
What might be the reason for this? I ran the exact sample code provided by MSDN. Is there something more I need to do in order to capture DirectX fullscreen games using DesktopDuplication API

OpenGL - Display video a stream of the desktop on Windows

So I am trying to figure out how get a video feed (or screenshot feed if I must) of the Desktop using OpenGL in Windows and display that in a 3D environment. I plan to integrate this with ARToolkit to make essentially a virtual screen. The only issue is that I have tried manually getting the pixels in OpenGl, but I have been unable to properly display them in a 3D environment?
I apologize in advance that I do not have minimum runnable code, but due to all the dependencies and whatnot trying to get an ARToolkit code running would be far from minimal. How would I capture the desktop on Windows and display it in ARToolkit?
BONUS: If you can grab each desktop from the 'virtual' desktops in Windows 10, that would be an excellent bonus!
Alternative: If you know another AR library that renders differently, or allows me to achieve the same effect, I would be grateful.
There are 2 different problems here:
a) Make an augmentation that plays video
b) Stream the desktop to somewhere else
For playing video on an augmentation you basically need to have a texture that gets updated on each frame. I recall that ARToolkit for Unity has an example that plays video.However.
Streaming the desktop to the other device is a problem of its own. There are tools that do screen recording, but you probably don't want that.
It sounds to me that what you want to do it to make a VLC viewer and put that into an augmentation. If I am correct, I suggest you to start by looking at existing open source VLC viewers.

Screen capture of MDI app with OpenGL graphics using MFC

In our MDI application - which is written in MFC - we have a function to save a screenshot of the MDI client area to file. We are currently doing a BitBlt from the screen into a bitmap, which is then saved. The problem is that some of the MDI child windows have their content rendered by OpenGL, and in the destination bitmap these areas show up as blank or garbled.
I have considered some alternatives:
- Extract the OpenGL content directly (using glReadPixels), and draw this to the relevant portions of the screen bitmap.
- Simulate an ALT+PrtScr, since doing this manually seems to get the content just fine. This will trash the clipboard content, though.
- Try working with the DWM. Appart from Vista and Win7, this also needs to work on Win2000 and XP, so this probably isn't the way to go.
Any input will be appreciated!
The best way to get a bitmap from an OpenGL window is to draw the content to a bitmap 'window'. See PFD_DRAW_TO_BITMAP for more information on how to do this.
If you want to go with the Alt+PrtScr way, you have to consider that many users have their own print screen tool installed which reacts on that very same hotkey. So you can't be sure that this hotkey will copy the content to the clipboard. It may just open the window of the installed print screen tool/utility.
Use the glReadPixels() approach. This question is asked quite often, here, on the gamedev.net forums and on other places, so google should show you code samples easily, but the glReadPixels() approach is the generally recommended approach.
Simulating keypresses is a recipe for disaster, I would stay away from that.

Displaying graphics on top of another full screen application; hardware overlay?

On Windows (Vista32), I want to display some simple graphics on top of a fullscreen flash window (an overlay of useful information while using the flash application). What's the fastest way to accomplish it?
I think I may be able to achieve it using DirectX with the DDSCAPS_OVERLAY flag but with the only example I've found I get an exception:
E_NOTIMPL
The function called is not supported at this time
on
m_direct_draw->CreateSurface(&ddsd, &m_overlay_surface, 0)
(full code here: http://nexe.gamedev.net/files/Overlay-2005-11-21.zip)
Something relevant to C/++ or Python would help me. I'm using the latest DirectX SDK.
Thank you
Just create a Layered Window and draw to it with an alpha channel - in WPF, this is as easy as setting the AllowsTransparency bit on the Window
While the transparent layered window is useful, it doesn't appear on top of the fullscreen flash with WS_EX_TOPMOST set.
Note sure how to reply to Paul sadly.
Overlaying on a 3D fullscreen application is very relevant but while it works and flash appears to load dx9, it doesn't show on flash.