Questions about Obtaining images using DC Handle...
When I get a DC handle of a window, say a button, I can obtain its image.
But when the button is obstructed by another window, say probably a form,
I'll get the partial form's image along with the button, too!
Which means to say, it's WYIWYG.
I want to get ONLY the image of the button, even when it's obstructed by
other objects.
Is there any solution here?
Thank you. :wave:
Re: Questions about Obtaining images using DC Handle...
Re: Questions about Obtaining images using DC Handle...
Quote:
Originally Posted by jian2587
Hello anyone out there:(
Yeah, a lot of us. But I don't know what code you use to do it now, so it would be good if you can post the code.
Re: Questions about Obtaining images using DC Handle...
It'll be something like this:
VB Code:
Dim butDC As Long, picDC As Long
butDC = GetWindowDC(Command1.hWnd)
picDC = GetWindowDC(Picture1.hWnd)
StretchBlt picDC, 0, 0, 320, 240, butDC, 0, 0, _
Command1.Width / Screen.TwipsPerPixelX, _
Command1.Height / Screen.TwipsPerPixelY, _
vbSrcCopy
Okay, nothing fancy here, so I didn't post my codes.
So Picture1 will get a picture of the button.
But when you drag a window and obstruct the button partially, the picture box will
have both the button and that window's image too.
What I want to do:
Regardless of the button being obstructed by another object, I want ONLY the picture
of the button, and in COMPLETE form, without any obstructions.
Anyone has done this before and are willing to share codes here?
Thank you.