I've read something about GetDIBits or BitBlt but i do not understand them.
That could be because i don't understand how Windows actually handles graphics on windows. It would be perfect if someone could refer me to a page where i could learn about these things! :)
I solved the problem using this code in the windows WM_PAINT. It now shows the exact same content as the target window.
What you want is to:
Alternatively for step 3 you can use the DWM or get hacky using the clipboard:
You might have some luck with sending the window a WM_PRINTCLIENT message. This may not work well for windows that use DirectX or OpenGL.
You may have some issues using WM_PRINTCLIENT on systems that have Aero enabled (i.e. when the DWM is active). If the system DOES have DWM active then it may offer ways of getting at the window backing store but I have not looked into doing that in any great depth before.