Results 1 to 8 of 8

Thread: Copying a specific Image into a form.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Does anyone know how to copy a specific window into a form by using "Bitblt"? If I have a handle to a specific window, how do I copy it into my form? Whether if it is minimized or maximized.


    Another question, is the only way possible to load an image file is using "LoadPicture". Can I use sometype of API to tell VB where the image file is located and load it in?


    If you help me, I will give you a penny, just kidding.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hi again Nitro!

    You need the hDC not the Hwnd for the window. Use the GetDC API:

    Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What's wrong with Loadpicture anyway?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    I am taking your advice from a couple of days ago not to use too many image controls. I am now learning how to use API such as BitBlt.

    BTW...For example, I put the Explorer's handle in GetDC(), but it still giving me the entire screen. I just want to copy Explorer view into the form(even when it is minimize).


    **What can I use to load an image file?
    Can you provide me the codes on getting the wallpaper using BitBlt. That will really help.

    Thanks again Kedaman.

    [Edited by Nitro on 03-29-2000 at 06:58 PM]
    Chemically Formulated As:
    Dr. Nitro

  5. #5
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Hi Nitro,

    Okay here goes:

    Declarations from win api
    (i have shortend them to make them fit)
    Declare function GetDesktopWindow() etc
    Declare function GetDC() etc
    Declare function BitBlt()etc


    Sub MySub()

    dim MyHwnd as long
    dim DskTopHwnd as long
    dim DskTopDc as long
    dim Dummy as long

    DskTopHwnd=getdesktopwindow()
    DskTopDc=GetDc(DskTopHwnd)
    Dummy = BitBlt(DestDc,tLeft,tTop,tWidth,tHeight,SourceHDc,RasterOp)

    I reckon the rasterop ought to SRCCOPY
    SourceDC must be Hdc of the source which would be DskTopDc
    DestDc would be wher yo want to paste the BitBlt output rect

    Hope it helps

    DocZaf
    {;->




  6. #6
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Hi Nitro,
    I forgot to add the last posting i entered does NOT work with minimised or NOT focused forms or objects

    Apologies
    DocZaf
    {;->

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Thanks Zaf Khan!

    I just got back and got your email. I will try your example now and keep you posted.

    Thanks again.

  8. #8
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Hi Nitro,

    I've emailed the raster ops declarations to you as it seemed a bit daft to clutter this great site with stuff that can be found in the winapi.txt file

    DocZaf
    {;->

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