Results 1 to 2 of 2

Thread: Copy the contents of a control that is off-screen

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Boca Raton, FL
    Posts
    9

    Question

    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.
    Sunny
    [email protected]

    Try a fresh new web browser: HyperSol WebSurfer
    http://www.HyperSol.com

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    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.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width