Results 1 to 11 of 11

Thread: [VB6] - error message without ID only message

  1. #1
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    [VB6] - error message without ID only message

    what means "out of stack space"?
    when i do:
    Code:
    If lngRotate <> 0 Then
            UserControl.Width = GRP.Width * Screen.TwipsPerPixelX
            UserControl.Height = GRP.Height * Screen.TwipsPerPixelY
        End If
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,255

    Re: [VB6] - error message without ID only message

    Read MSDN description of this error.

    I guess this code is in a recursive procedure.
    Last edited by 4x2y; Oct 7th, 2012 at 10:01 PM.

  3. #3
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    Re: [VB6] - error message without ID only message


    ok. i have the resize event on usercontrol. but why i get the error only in that lines and not before(yes before that lines i resize the control. but when i use the rotate effect, i must resize the control)?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,655

    Re: [VB6] - error message without ID only message

    wait... you have that code in the resize event? which will also cause a resize event to be triggered... running that code... which triggers the resize event, which runs that code, which triggers the resize event, which fires off that code... you see where this is going?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  5. #5
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    Re: [VB6] - error message without ID only message

    i have 1 code for show the image and resize the control(usercontrol). but if we resize the control the control(itself) activate the resize event
    Code:
    Private Sub UserControl_Resize()
        On Error Resume Next
        If UserControl.hWnd = 0 Then Exit Sub
        If blnShowed = True Then Call ShowImage
        If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
            ResizeTyp = ResizeVerticalHorizontal
        ElseIf UserControl.Width <> lngOldWidth Then
            ResizeTyp = ResizeHorizontal
        ElseIf UserControl.Height <> lngOldHeight Then
            ResizeTyp = ResizeVertical
        End If
        lngOldWidth = UserControl.Width
        lngOldHeight = UserControl.Height
        RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
    End Sub
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #6
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,255

    Re: [VB6] - error message without ID only message

    When you resize the control inside its Resize event, it is fire infinity, to control this, add a flag to exit the Resize event when perform resize inside it, Ex
    Code:
    Private Sub Form_Resize()
        Static blnResizing As Boolean
        
        If blnResizing Then Exit Sub' comment this line and see the difference :-)
        
        blnResizing = True
        Me.Width = Me.Width + Screen.TwipsPerPixelX * 8
        blnResizing = False
    End Sub

  7. #7
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    Re: [VB6] - error message without ID only message

    Quote Originally Posted by 4x2y View Post
    When you resize the control inside its Resize event, it is fire infinity, to control this, add a flag to exit the Resize event when perform resize inside it, Ex
    Code:
    Private Sub Form_Resize()
        Static blnResizing As Boolean
        
        If blnResizing Then Exit Sub' comment this line and see the difference :-)
        
        blnResizing = True
        Me.Width = Me.Width + Screen.TwipsPerPixelX * 8
        blnResizing = False
    End Sub
    you have right. it's a infinite cycle. and i don't know how avoid that
    VB6 2D Sprite control

    To live is difficult, but we do it.

  8. #8
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,255

    Re: [VB6] - error message without ID only message

    i don't know how avoid that
    Like i did

    Code:
    Private Sub UserControl_Resize()
        Static blnResizing As Boolean ' ----------------- New Code
        On Error Resume Next
        If blnResizing Then Exit Sub ' ----------------- New Code
        If UserControl.hWnd = 0 Then Exit Sub
        If blnShowed = True Then Call ShowImage
        If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
            ResizeTyp = ResizeVerticalHorizontal
        ElseIf UserControl.Width <> lngOldWidth Then
            ResizeTyp = ResizeHorizontal
        ElseIf UserControl.Height <> lngOldHeight Then
            ResizeTyp = ResizeVertical
        End If
        lngOldWidth = UserControl.Width
        lngOldHeight = UserControl.Height
        
        
        blnResizing = True ' ----------------- New Code
        RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
        blnResizing = False ' ----------------- New Code
        
    End Sub
    I don't know if this will be compatible with your code or not, just give it a try.
    Last edited by 4x2y; Oct 8th, 2012 at 08:26 AM.

  9. #9
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    Re: [VB6] - error message without ID only message

    Quote Originally Posted by 4x2y View Post
    Like i did

    Code:
    Private Sub UserControl_Resize()
        Static blnResizing As Boolean ' ----------------- New Code
        On Error Resume Next
        If blnResizing Then Exit Sub ' ----------------- New Code
        If UserControl.hWnd = 0 Then Exit Sub
        If blnShowed = True Then Call ShowImage
        If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
            ResizeTyp = ResizeVerticalHorizontal
        ElseIf UserControl.Width <> lngOldWidth Then
            ResizeTyp = ResizeHorizontal
        ElseIf UserControl.Height <> lngOldHeight Then
            ResizeTyp = ResizeVertical
        End If
        lngOldWidth = UserControl.Width
        lngOldHeight = UserControl.Height
        
        
        blnResizing = True ' ----------------- New Code
        RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
        blnResizing = False ' ----------------- New Code
        
    End Sub
    I don't know if this will be compatible with your code or not, just give it a try.
    and i did and works:
    Code:
    Private Sub UserControl_Resize()
        Static blnResizing As Boolean
        If blnResizing Then Exit Sub ' comment this line and see the difference :-)
        
        blnResizing = True
    
        On Error Resume Next
        If UserControl.hWnd = 0 Then Exit Sub
        If blnShowed = True Then Call ShowImage
        If (UserControl.Width <> lngOldWidth And UserControl.Height <> lngOldHeight) Then
            ResizeTyp = ResizeVerticalHorizontal
        ElseIf UserControl.Width <> lngOldWidth Then
            ResizeTyp = ResizeHorizontal
        ElseIf UserControl.Height <> lngOldHeight Then
            ResizeTyp = ResizeVertical
        End If
        lngOldWidth = UserControl.Width
        lngOldHeight = UserControl.Height
        RaiseEvent Resize(UserControl.Width, UserControl.Height, ResizeTyp)
        blnResizing = False
    
    End Sub
    i have a new question that i think you can advice me
    i want do the same to showimage() sub. but like you know, we, always, change the graphics effects properties. then how i can do that boolean way? in same way?
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  10. #10
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,255

    Re: [VB6] - error message without ID only message

    i want do the same to showimage() sub. but like you know, we, always, change the graphics effects properties. then how i can do that boolean way? in same way?
    I cannot give you a sample code because i don't know which properties are affected by ShowImage sub, but in general if i have one ore more property i don't want to execute it when changing its value (by code), i declare a module level boolean variable, set it to true before changing the property value and false after it, and in the property or the event it is fire i check the module level boolean variable. Here is a sample i frequently use with TextBox, i hope it help you.

    Code:
    Private mblnChangedByCode As Boolean
    
    Private Sub Test()
        mblnChangedByCode = True
        Text1.Text = "Value"
        mblnChangedByCode = False
    End Sub
    
    
    
    Private Sub Text1_Change()
        If mblnChangedByCode = True Then Exit Sub
        
        ' Here is some code i want to execute it ONLY if the user changed the text by typing something,
        ' but never execute when i change the text via the Text property.
    End Sub

  11. #11
    PowerPoster joaquim's Avatar
    Join Date
    Apr 07
    Posts
    2,494

    Re: [VB6] - error message without ID only message

    Quote Originally Posted by 4x2y View Post
    I cannot give you a sample code because i don't know which properties are affected by ShowImage sub, but in general if i have one ore more property i don't want to execute it when changing its value (by code), i declare a module level boolean variable, set it to true before changing the property value and false after it, and in the property or the event it is fire i check the module level boolean variable. Here is a sample i frequently use with TextBox, i hope it help you.

    Code:
    Private mblnChangedByCode As Boolean
    
    Private Sub Test()
        mblnChangedByCode = True
        Text1.Text = "Value"
        mblnChangedByCode = False
    End Sub
    
    
    Private Sub Text1_Change()
        If mblnChangedByCode = True Then Exit Sub
        
        ' Here is some code i want to execute it ONLY if the user changed the text by typing something,
        ' but never execute when i change the text via the Text property.
    End Sub
    thanks for all
    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
  •