Skip to content

Need Help with program code freezing problems

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #190165
    Admin
    Administrator

    😆 wha up peeps, any one had any tips on how to stop a program from freezing, like this program i made

    The problem I am having is that when lets say the user chooses the 10 seconds brake between each message, And when the program is in action and they decide to stop it it freezes.

    lol dont know it got to do with some timer thing, like when the process start is hard to stop or some shit, dont know

    so is there some thing i can put like between each message here is the code anyways for the 10 seconds message brake in a timer

    If Check1.Value = 1 Then
    Call RoomSend(RichTextBox1.TextRTF)
    DoEvents
    Sleep 10000
    End If
    If Check2.Value = 1 Then
    Call RoomSend(RichTextBox2.TextRTF)
    DoEvents
    Sleep 10000
    End If
    If Check3.Value = 1 Then
    Call RoomSend(RichTextBox3.TextRTF)
    DoEvents
    Sleep 10000
    End If
    If Check4.Value = 1 Then
    Call RoomSend(RichTextBox4.TextRTF)
    DoEvents
    Sleep 10000
    End If
    If Check5.Value = 1 Then
    Call RoomSend(RichTextBox5.TextRTF)
    DoEvents
    Sleep 10000
    End If

    Thanks 🙂

    #190169
    Admin
    Administrator

    Lol I think I fix went to

    And found this cool code

    Basically I added this code

    Sub Delay(ByVal nSeconds As Single)
    Dim nStart As Single

    nStart = Timer

    Do
    DoEvents
    Loop Until Timer - nStart >= nSeconds
    End Sub

    Then I change the timer code to this

    If Check1.Value = 1 Then
    Call RoomSend(RichTextBox1.TextRTF)
    DoEvents
    Call Delay(10)
    End If
    If Check2.Value = 1 Then
    Call RoomSend(RichTextBox2.TextRTF)
    DoEvents
    Call Delay(10)
    End If
    If Check3.Value = 1 Then
    Call RoomSend(RichTextBox3.TextRTF)
    DoEvents
    Call Delay(10)
    End If
    If Check4.Value = 1 Then
    Call RoomSend(RichTextBox4.TextRTF)
    DoEvents
    Call Delay(10)
    End If
    If Check5.Value = 1 Then
    Call RoomSend(RichTextBox5.TextRTF)
    DoEvents
    Call Delay(10)
    End If

    Yess it doesnt freeses nomore 😈

    #190168
    Kittenless
    Member

    yeah it was the acutall sleep command..

    the sleep command tells windows to basically ignore the application for that amount of time and give it no CPU time.

    the other “Delay” allows you to skip doing stuff until the “time” is up..

    basically thats what the difference between the two..

    lol

    #190167
    Admin
    Administrator

    yeps with the first one, it always freeze, so it was a life saver 🙂

    #190166
    Johnny5
    Member

    Try to Debug point cursor on loop then debug it

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.