PDA

Click to See Complete Forum and Search --> : GetWindowDC problem


Mad Compie
Jun 8th, 2001, 01:52 PM
Hi kids.

Using GetWindowDC(), invisible parts of the window are not included in the obtained DC. Why?

I attached some code.

When you click at Form1, the contents of Form2 are Blt into Form1. When you move some part of Form2 so that it would be invisible, this invisible part are no longer painted anymore until it becomes visible again.

Any one know this behaviour?

thinh
Jun 9th, 2001, 12:04 AM
This not your fault. the Bitblt function will only copy everything that is within the border of one DC to another.
you can try this with two pictureboxes.
fist try to use Bitblt with the source picturebox's border greater or equals to the size of the image. (it doesn't matters if the picturebox's visible property is set to true or false).

second try to use Bitblt with the source picturebox's border less than the size of the image.

will see the difference.

Mad Compie
Jun 9th, 2001, 08:50 AM
Yes, but how can I grab a copy of the complete window (including it's controls) even if part of the window is invisible?

jim mcnamara
Jun 9th, 2001, 06:06 PM
You are asking - Why?

The answer is that BitBlt copies physical pixels on the screen as part of the window (what your eye sees), not what may or may not be underneath or invisible.

Look up windows metafiles on MSDN, this explains how to keep a separate copy of a window in memory, as it 'supposed' to look; you can blt this anywhere and have all the controls or whatever show up. Or look up the Graphics and Windows chapters in Appleman's book on the Win32 api.

All this assumes your app owns the window.:eek:

Mad Compie
Jun 10th, 2001, 02:25 AM
The question is: how.

I don't want to draw controls in software. I want to grab a copy of a form window (made in VB desgin view) with al it's controls included.
Anybody knows how?