I'm totally lost here. I want to grab the visual content of a window for further processing, inside my console application. I know how to find the HWND, but from that I don't know what to do to get the content. The application I want to grab is 3D, but I don't know if its Direct3D or OpenGL, but I need to process every frame (some frame skipping would be acceptable though)

1 Answer
1

You'll need to look into the BitBlt() function. If you're not familiar with the Win32 GDI, the way to proceed might seem unintuitive. Take a look at this BitBlt() Copy and Paste tutorial. The article doesn't present the whole code, and it's VB.net, but the outline of the method is presented (Window Handles, Graphics Contexts, BitBlt() and their relashionships).

If this question is still unanswered in a few hours I'll post a more precise, C++ oriented answer then (I don't have the code with me right now).

Does the BitBlt() function work with 3D applications?
–
VeehmotOct 28 '10 at 14:01

It grabs the current contents of the window, whatever is there, including whatever the 3D application rendered in it. I helped a friend write a bot for a 3D game once using OCR in part of the captured frame.
–
André CaronOct 28 '10 at 16:05