Catrina
February 17th, 2000, 07:25 AM
I am trying to convert an old DOS dialup
communications program to windows.
The program dials the number (I left it out, didn't want to post it on
the web), then sends out 6s until it receives a 7 from the receiving end.
I added text boxes just to see if the program was working. At first it
timed out too quickly, so we made a few changes, now it dials and connects,
but then freezes my computer. I have to CTRL ALT Delete to get out.
Here is the code. Can you see a reason for the freezing. Next I will be
adding the code to send a password, then extract the files from the sending end and transmit
them. Any help for this problem and advice for the next step will be great appreciated!
Private Sub Command1_Click()
MSComm1.CommPort = 2
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MSComm1.Output = "ATDT Number" & vbCr
MSComm1.InputLen = 1
WaitForInput:
If MSComm1.InBufferCount = 0 Then
GoTo WaitForInput
End If
C$ = MSComm1.Input
If C$ = Chr$(10) Then GoTo WaitForInput
If C$ = Chr$(13) Then GoTo TestConnect
P$ = P$ + C$
Text2.Text = P$
GoTo WaitForInput
TestConnect:
Text2.Text = P$
If InStr(P$, "CONNECT") Then GoTo 22175
P$ = ""
GoTo WaitForInput
22175 For A! = 1 To 100000
If MSComm1.InBufferCount = 0 Then GoTo 22201
A! = 1
C$ = MSComm1.Input
If C$ = Chr$(13) Then COUNTS% = COUNTS% + 1
If COUNTS% = 50 Then GoTo 22161
22200 If C$ = Chr$(7) Then GoTo 22204
22201 MSComm1.Output = (Chr$(6) & Chr$(13))
Next A!
Text1.Text = "Timeout"
GoTo 22175
22204 Text1.Text = "Works!"
Exit Sub
22161 Text1.Text = "Errors"
End Sub
Private Sub Exit_Click()
End
End Sub
communications program to windows.
The program dials the number (I left it out, didn't want to post it on
the web), then sends out 6s until it receives a 7 from the receiving end.
I added text boxes just to see if the program was working. At first it
timed out too quickly, so we made a few changes, now it dials and connects,
but then freezes my computer. I have to CTRL ALT Delete to get out.
Here is the code. Can you see a reason for the freezing. Next I will be
adding the code to send a password, then extract the files from the sending end and transmit
them. Any help for this problem and advice for the next step will be great appreciated!
Private Sub Command1_Click()
MSComm1.CommPort = 2
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MSComm1.Output = "ATDT Number" & vbCr
MSComm1.InputLen = 1
WaitForInput:
If MSComm1.InBufferCount = 0 Then
GoTo WaitForInput
End If
C$ = MSComm1.Input
If C$ = Chr$(10) Then GoTo WaitForInput
If C$ = Chr$(13) Then GoTo TestConnect
P$ = P$ + C$
Text2.Text = P$
GoTo WaitForInput
TestConnect:
Text2.Text = P$
If InStr(P$, "CONNECT") Then GoTo 22175
P$ = ""
GoTo WaitForInput
22175 For A! = 1 To 100000
If MSComm1.InBufferCount = 0 Then GoTo 22201
A! = 1
C$ = MSComm1.Input
If C$ = Chr$(13) Then COUNTS% = COUNTS% + 1
If COUNTS% = 50 Then GoTo 22161
22200 If C$ = Chr$(7) Then GoTo 22204
22201 MSComm1.Output = (Chr$(6) & Chr$(13))
Next A!
Text1.Text = "Timeout"
GoTo 22175
22204 Text1.Text = "Works!"
Exit Sub
22161 Text1.Text = "Errors"
End Sub
Private Sub Exit_Click()
End
End Sub