HyperSol
Mar 15th, 2001, 04:00 PM
I would like to copy the contents of a control, like the WebBrowser control, into a picturebox. I cannot use BitBlt or StreatchBlt as they will only return a blank image if the control is off-screen.
Anybody know any other way?
What I am trying to do is make a thumbnail of a web page.
Lord Orwell
Mar 17th, 2001, 01:41 AM
It may not be possible. The hdc you get from a window is the actual window on screen. This window gets refreshed from a memory original. You have to come up with some way of copying from the original that is stored.
I haven't tried it, but you might be able to get this api call to work:
Declare Function CopyImage& Lib "user32" (ByVal handle As Long, ByVal un1 As _
Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long)
Description
Allows you to copy a bitmap, icon, or cursor, performing some transformations on it during the copy.
Use with VB
No problem.
Parameter Type/Description
handle Long—A handle to the image to copy.
un1 Long—One of the constants IMAGE_BITMAP, IMAGE_CURSOR, or IMAGE_ICON.
n1 Long—The width of the copy in pixels.
n2 Long—The height of the copy in pixels.
un2 Long—One or more of the following constants combined:LR_DELETEORG—Delete the original image.LR_COPYRETURNORG—Ignore n1 & n2.LR_MONOCHROME—Create a monochrome copy.LR_COPYFROMRESOURCE—Creates a copy based on the original resource from which the original was loaded. Say you are trying to make a 64 x 64 copy of a 32 x 32 icon. Without this flag, CopyImage will stretch the original icon. With this flag, CopyImage will first check to see if a 64x64 version of this icon exists in the resource file—if so, it will load this higher quality image.