PDA

View Full Version : Win32 Clipping


TheNut
04-23-2006, 07:46 PM
I'm trying to take a screenshot of a child window that extends beyond its parent window viewing region. For performance reasons, MS doesn't render this portion and hence my screenshot is only a portion in size. Is there any way I can force it to render the entire window or am I going to have to get down and dirty with some hack to do it?

The method I'm currently using involves creating a destination DC with a DIB where I blit the contents of the source window over. With my bitmap pointer, I save the contents out to a file.

Nils Pipenbrinck
04-24-2006, 12:17 PM
I think the way to go is to send the child-window a WM_PAINT-message with a user-defined HDC (probably a memory DC with a bitmap attached).

That should do the trick.

TheNut
04-24-2006, 07:25 PM
I just tried out the "WM_PRINT" and "WM_PRINTCLIENT" with no luck. I'm baffled as to why windows doesn't implement this by default in all their windows/controls. I consider this to be a pretty standard feature to have.

I followed this website: http://www.fengyuan.com/article/wmprint.html, which seems to implement a far more complicated procedure. In fact, in the very end the copy procedure is almost identical to my blitting operation, only that it snakes its way around the windows messages. Unfortuantely, all I get is a white background, no picture. Blitting seems to be the only success I am getting, but it's only a peice of the picture. Bloody hell...

TheNut
04-24-2006, 08:03 PM
Actually, ta hell with windows =P

I spent the last few minutes writing a "panoramic stitch" hack. Works like a dream and 1/10th the hassel =)