I have a main window with children. I need to take screenshots programmatically to crop and draw them back on my main window. The way I do this is:
HDC hDC =
I assume you are on win platform.
I thing you can render to bitmap even if you do not have the source code for child window.
Beware this is not very stable process (OpenGL can make conflicts during context handles change) and in some cases you even cannot change handles to contexts
More safe is to screenshot desktop it self.
TCanvas *scr=new TCanvas();
scr->Handle=GetDC(GetDesktopWindow());
// copy scr to your bitmap (do not forget to resize bitmap)
Warning do not obtain/create/release contexts or win handles too often because its a little buggy (sometimes winapi functions stops returning correct handler values) better way is obtain handle once and hope that no one closes window ... for your child wins you know exactly when to get new handler) That is true also for IsWindow() function.
For more info take a look at: