Results 1 to 4 of 4

Thread: [VB6] - capture a parent(container) from an Activex Control(UserControl)

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    [VB6] - capture a parent(container) from an Activex Control(UserControl)

    i have 1 code, that works fine, for capture the container(parent):
    Code:
    Public Sub CaptureContiner(DestinationHDC As Long, SourceHWND As Long, SourceX As Long, SourceY As Long, SourceWidth As Long, SourceHeight As Long)
        'SourceHWND = GetDC(SourceHWND)
        BitBlt DestinationHDC, 0, 0, SourceWidth, SourceHeight, SourceHWND, SourceX, SourceY, vbSrcCopy
    End Sub
    but when i use on in side of my control:
    Code:
    CaptureContiner PicAnimation(PicAnimation.Count - 1).hdc, UserControl.Parent.hdc, Extender.left, Extender.top, UserControl.Width, UserControl.Height
    it only catch the parent(container) image without controls(but like an image)
    my error is these HDC?
    UserControl.Parent.hdc???
    or other?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: [VB6] - capture a parent(container) from an Activex Control(UserControl)

    now catch with controls:
    Code:
    Public Sub CaptureContiner(DestinationHDC As Long, SourceHWND As Long, SourceX As Long, SourceY As Long, SourceWidth As Long, SourceHeight As Long)
        SourceHWND = GetDC(SourceHWND)
        BitBlt DestinationHDC, 0, 0, SourceWidth, SourceHeight, SourceHWND, SourceX, SourceY, vbSrcCopy
    End Sub
    
    'heres how i use it:
    .....
    CaptureContiner Picture2.hdc, UserControl.ContainerHwnd, _
           Extender.Top, Extender.Left, Extender.Width, Extender.Height
    ....
    but the problem is that i don't recive the right position
    so heres the question: why the extender object don't give me correct values(but i see the results on form and i know the position is right)?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: [VB6] - capture a parent(container) from an Activex Control(UserControl)

    now i put it to work. but i have 1 problem: how can i capture it without usercontrol?
    i try clean what it inside of usercontrol, but by some reason, still catch it
    any advices
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: [VB6] - capture a parent(container) from an Activex Control(UserControl)

    Code:
    Public Sub CaptureContainer(DestinationHDC As Long, SourceHWND As Long, SourceX As Long, SourceY As Long, SourceWidth As Long, SourceHeight As Long)
        SourceHWND = GetDC(SourceHWND)
        BitBlt DestinationHDC, 0, 0, SourceWidth, SourceHeight, SourceHWND, SourceX, SourceY, vbSrcCopy
        'StretchBlt DestinationHDC, 0, 0, SourceWidth, SourceHeight, SourceHWND, SourceX, SourceY, SourceWidth, SourceHeight, vbSrcCopy
    End Sub
    using these code i can capture the parent without a problem
    my problem is: why i can't:
    Code:
    usercontrol.picture=nothing
    usercontrol.maskpicture=nothing
    (after these code i use the CaptureContainer() sub)
    ???
    why the usercontrol isn't clean?
    (unless i use 'doevents' before the CaptureContainer() sub)
    VB6 2D Sprite control

    To live is difficult, but we do it.

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