brakes
asked on
Sned/REceive SMS through GSM Modem via PCMCIA
i am using vb6 to create the interface that would send and receive sms. i already have a gsm modem but not like the ones most members of experts-exchange talk about. my modem is connected to my laptop via pcmcia slot (DZ-800). i am using AT-Commands to communicate with my gsm modem. here's how the code in vb goes:
Private Sub cmdSendMesg_Click()
With mscomm1
.CommPort = 5
.InputLen = 0
.Settings = "115200,N,8,1"
If Not .PortOpen Then
.PortOpen = True
End If
.Output = "AT" & Chr$(13) & Chr(10)
.Output = "AT+CMGF=1" & Chr$(13) & Chr(10)
.Output = "AT+CSCA=" & Chr$(34) & "+639189035759" & Chr(34) & _
Chr$(13) & Chr(10)
.Output = "AT+CMGS=" & Chr$(34) & txtRecpMobileNo & Chr(34) & Chr(10)
.Output = txtMesg & Chr$(13) & Chr(26) & Chr$(13) & Chr(10)
Dim dtToday As Date
dtToday = Now()
Do
DoEvents
buffer$ = buffer$ & .Input
Loop Until InStr(buffer$, "OK") Or Now > DateAdd("s", 10, dtToday)
If InStr(buffer$, "OK") Then
MsgBox "Message Sent"
Else
MsgBox "Unable to send message"
End If
.PortOpen = False
End With
End Sub
if you would notice, my port number is set to 5. this is because under control panel the port for my pcmcia card is set at 5.
when i ran the program at port5, the invalid port number error appears. when i tried to change to port 1, the msgbox would appear saying "unable to send message". when i changed to port number 2, msgbox "message sent" would appear but actually there is no sms sent.
i've been working on this code for 4 days now and to tell you guys honestly, i'm going cuckoo right now. can anybody please help me. pls tell what's wrong?? is the problem with the code or with the modem?? if so please specify solution. thanks you guys.
Private Sub cmdSendMesg_Click()
With mscomm1
.CommPort = 5
.InputLen = 0
.Settings = "115200,N,8,1"
If Not .PortOpen Then
.PortOpen = True
End If
.Output = "AT" & Chr$(13) & Chr(10)
.Output = "AT+CMGF=1" & Chr$(13) & Chr(10)
.Output = "AT+CSCA=" & Chr$(34) & "+639189035759" & Chr(34) & _
Chr$(13) & Chr(10)
.Output = "AT+CMGS=" & Chr$(34) & txtRecpMobileNo & Chr(34) & Chr(10)
.Output = txtMesg & Chr$(13) & Chr(26) & Chr$(13) & Chr(10)
Dim dtToday As Date
dtToday = Now()
Do
DoEvents
buffer$ = buffer$ & .Input
Loop Until InStr(buffer$, "OK") Or Now > DateAdd("s", 10, dtToday)
If InStr(buffer$, "OK") Then
MsgBox "Message Sent"
Else
MsgBox "Unable to send message"
End If
.PortOpen = False
End With
End Sub
if you would notice, my port number is set to 5. this is because under control panel the port for my pcmcia card is set at 5.
when i ran the program at port5, the invalid port number error appears. when i tried to change to port 1, the msgbox would appear saying "unable to send message". when i changed to port number 2, msgbox "message sent" would appear but actually there is no sms sent.
i've been working on this code for 4 days now and to tell you guys honestly, i'm going cuckoo right now. can anybody please help me. pls tell what's wrong?? is the problem with the code or with the modem?? if so please specify solution. thanks you guys.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It will run perfectly ok if u run on comport 2, I have to read the code and find out whats the problem.
Bye
Amit