Original Post
In short, I have a hidden window with an ActiveX control on it of some form or another, and I need to get the pixel data from that control so that I can copy it to a Direct3D texture surface. The problem is that I cannot seem to force the window to paint; it simply does nothing, since it is not visible. I have gotten this to work with one control, the Macromedia Flash control. To do so, I simply called SendMessage(hWndFlash, WM_PAINT, (WPARAM)hDC, 0); where hDC was a device context that I made myself, and that had a bitmap selected into it that I also had created myself. I could then call GetDIBits() on that bitmap to copy the pixel data to a locked Direct3D surface. Works fine. However, WM_PAINT's documentation states that while the wParam can refer to an arbitrary DC on which the control should paint, this is only for certain controls that choose to support this, and other windows can safely ignore the wParam for the WM_PAINT message. This is the case when working with, for example, the WebBrowser control in "system32\shdocvw.oca". No matter what I do, it paints to it's own DC. And if I merely try to copy data from its DC (using GetDC() or GetWindowDC() in order to get the handle to the DC), all I really get is data from the desktop. If the WebBrowser control's container window is visible and on top, I do indeed have access to the control's pixel data, as the control is visible from the desktop's DC. But considering my program is (in release mode) a fullscreen Direct3D application, this is entirely impossible. I somehow need to trick the window into painting to a DC/bitmap that I create myself, and force it to paint regardless of if it is invisible, behind other windows, or off the edge of the screen. I've looked in the documentation and haven't found anything that looks promising aside from WM_PAINT's wParam, which doesn't work. And I've tried all sorts of things even if they don't sound too promising. I've tried invalidating the entire window, forcing the clipping region to include the whole window, and all sorts of stuff. I've trying SendMessage(), PostMessage(), UpdateWindow(), RedrawWindow(), and InvalidateRect(), in all sorts of combinations even if they didn't make sense. I've tried getting DCs and selecting my own bitmaps into them before telling the window to paint. Nothing gives me any success. So if someone has had to force a window to paint before and knows what needs to be done (if it is in fact possible), I'd love to hear it.