tommy_121314
12-16-2001, 12:29 AM
Hi to all experts,
I think i am driven crazy by the MSComm32
I am wondering why I just can't receive the response from my
modem.
Can any body tell me whats wrong with my codes?
Thanx for any helps and suggestions
Option Explicit
Dim buffer As String
Private Sub cmdOpenClose_Click()
If comm.PortOpen = True Then
comm.PortOpen = False
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Close"
Else
comm.PortOpen = True
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Open"
End If
End Sub
Private Sub cmdSend_Click()
Dim cmd As String
If comm.PortOpen = False Then
comm.PortOpen = True
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Open"
End If
cmd = txtCmd.Text & vbCr
comm.Output = cmd
txtCmd = ""
tmSts.Enabled = True
stsPort.SimpleText = "Port Status : " _
& "sending command : " & cmd
End Sub
Private Sub comm_OnComm()
tmSts.Enabled = True
stsPort.SimpleText = "Port Status : receive event"
Select Case comm.CommEvent
Case comEvReceive:
Do While comm.InBufferCount > 0
buffer = comm.Input
txtResponse = txtResponse & buffer
txtResponse = txtResponse & vbCrLf
Loop
Break
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
If comm.PortOpen = True Then
comm.PortOpen = False
End If
End Sub
Private Sub optCom1_Click()
comm.CommPort = 1
End Sub
Private Sub optCom2_Click()
comm.CommPort = 2
End Sub
Private Sub tmSts_Timer()
If comm.PortOpen = True Then
stsPort.SimpleText = "Port Status : Open"
Else
stsPort.SimpleText = "Port Status : Close"
End If
tmSts.Enabled = False
End Sub
I think i am driven crazy by the MSComm32
I am wondering why I just can't receive the response from my
modem.
Can any body tell me whats wrong with my codes?
Thanx for any helps and suggestions
Option Explicit
Dim buffer As String
Private Sub cmdOpenClose_Click()
If comm.PortOpen = True Then
comm.PortOpen = False
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Close"
Else
comm.PortOpen = True
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Open"
End If
End Sub
Private Sub cmdSend_Click()
Dim cmd As String
If comm.PortOpen = False Then
comm.PortOpen = True
optCom1.Enabled = False
optCom2.Enabled = False
stsPort.SimpleText = "Port Status : Open"
End If
cmd = txtCmd.Text & vbCr
comm.Output = cmd
txtCmd = ""
tmSts.Enabled = True
stsPort.SimpleText = "Port Status : " _
& "sending command : " & cmd
End Sub
Private Sub comm_OnComm()
tmSts.Enabled = True
stsPort.SimpleText = "Port Status : receive event"
Select Case comm.CommEvent
Case comEvReceive:
Do While comm.InBufferCount > 0
buffer = comm.Input
txtResponse = txtResponse & buffer
txtResponse = txtResponse & vbCrLf
Loop
Break
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
If comm.PortOpen = True Then
comm.PortOpen = False
End If
End Sub
Private Sub optCom1_Click()
comm.CommPort = 1
End Sub
Private Sub optCom2_Click()
comm.CommPort = 2
End Sub
Private Sub tmSts_Timer()
If comm.PortOpen = True Then
stsPort.SimpleText = "Port Status : Open"
Else
stsPort.SimpleText = "Port Status : Close"
End If
tmSts.Enabled = False
End Sub