Results 1 to 5 of 5

Thread: [RESOLVED] [VB6] -strange bug

  1. #1

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

    Resolved [RESOLVED] [VB6] -strange bug

    when i try move my new control, with mouse in, my object don't move and the properties aren't, normaly changed(inlued other instances)
    but after i take the mouse out of control, the control works normaly.
    heres the mouse move event inside of control:
    Code:
    Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        If x > MousePos.x Then
            mdMouseDirection = MouseDirectionRight
        ElseIf x < MousePos.x Then
            mdMouseDirection = MouseDirectionLeft
        ElseIf y < MousePos.y Then
            mdMouseDirection = MouseDirectionUp
        ElseIf y > MousePos.y Then
            mdMouseDirection = MouseDirectionDown
        ElseIf x < MousePos.x And y < MousePos.y Then
            mdMouseDirection = MouseDirectionLeftUp
        ElseIf x < MousePos.x And y > MousePos.y Then
            mdMouseDirection = MouseDirectionLeftDown
        ElseIf x > MousePos.x And y < MousePos.y Then
            mdMouseDirection = MouseDirectionRightDown
        ElseIf x < MousePos.x And y > MousePos.y Then
            mdMouseDirection = MouseDirectionRightUp
        End If
        MousePos.x = x
        MousePos.y = y
        mbMouseButton = Button
        skShift = Shift
        With UserControl
            If GetCapture <> .hWnd Then SetCapture .hWnd
            If ((x < 0 Or y < 0 Or x > .ScaleWidth Or y > .ScaleHeight) Or IIf(traTransparent = TransparentAutomatic Or traTransparent = TransparentManualy, GetPixel(UserControl.hDC, MousePos.x, MousePos.y) = UserControl.Backcolor, GetPixel(UserControl.hDC, MousePos.x, MousePos.y) = -1)) Then  ' we're off the form
                ReleaseCapture
                blnEnter = True
                MouseOverControl = 0
                RaiseEvent MouseExit(mbMouseButton, skShift, CLng(MousePos.x), CLng(MousePos.y), mdMouseDirection)
                mdMouseDirection = MouseDirectionNone
            Else
                If blnEnter = True Then
                    blnEnter = False
                    lngOldMouseX = MousePos.x
                    lngOldMouseY = MousePos.y
                    MouseOverControl = UserControl.hWnd
                    RaiseEvent MouseEnter(mbMouseButton, skShift, x, y, mdMouseDirection)
                End If
            End If
        End With
        RaiseEvent MouseMove(mbMouseButton, skShift, x, y, mdMouseDirection)
    End Sub
    and these problem happens in 1st time(after execute the project). then works normaly.
    any help?
    thanks
    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,960

    Re: [VB6] -strange bug

    how the mouse stop "event" can block every instances of my object?
    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,960

    Re: [VB6] -strange bug

    stilling testing. i found another information. if the mouse is out side of control, i can work normaly with control. but if i move the control to mouse position(i tested now), until i move the mouse every instances of control just stop(animation stops\pauses(after the mouse go out, the image is updated to correct one) and the control don't move
    why these is appenning?
    Last edited by joaquim; Mar 17th, 2010 at 04:23 PM.
    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,960

    Re: [VB6] -strange bug

    what maskcolor, maskpicture and backstyle=0 has to do with mouse?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5

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

    Re: [VB6] -strange bug

    the problem was the keyword DoEvents, in animated gif function.
    thanks
    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