MSComm.CommEvent 
Author Message
 MSComm.CommEvent

Could anybody please clarify why MSComm1.CommEvent
return "111" in following code?

Option Explicit
Private Sub SendIt(Number$, Message$)
Dim Buffer As Variant

MSComm1.CommPort = 1
MSComm1.Settings = "9600, N, 8, 1"
MSComm1.RThreshold = 1

On Error Resume Next
MSComm1.PortOpen = True
If Err Then
 MsgBox "COM1 Error"
 Exit Sub
End If

MSComm1.Output = "AT+CMGS=" + """" + Number$ + """" + vbCr

Do
  DoEvents
  Buffer = Buffer + MSComm1.CommEvent
   Text1.Text = Buffer
   Loop Until InStr(Buffer, ">")

MSComm1.Output = Message$ + " " + vbCr

End Sub

Private Sub Form_Load()
MSComm1.InputLen = 0
SendIt "80950000000", "Hello"
End Sub



Fri, 30 Jul 2004 21:11:11 GMT  
 MSComm.CommEvent
Hi,

First, do not use Variants.

Dim Buffer As String

Second, you set RTHreshold = 1, but not not using OnComm to receive data.
Either place receive code in the OnComm process, or set RThreshold = 0.

Now, as to why you are seeing what you are seeing?
I do not understand this statement:

MSComm1.Output = Message$ + " " + vbCr

Are you sure that this is correct?

--
Richard Grier  (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Leave voice mail or fax that I can receive as email at 303-593-9315
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com.



Sat, 31 Jul 2004 01:32:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MSComm.CommEvent

2. mscomm & CommEvent

3. CommEvent howto??

4. CommEvent Usage

5. CommEvent "EOF", can I disable it?

6. mscomm1.commEvent read locks the mouse

7. CommEvent problem

8. MSCOMM Answer - mscomm.zip (1/1)

9. MSCOMM Answer - mscomm.zip (0/1)

10. MSCOMM - Port data, Mscomm no data

11. MScomm, MSComm.Input

12. Closing MSCOMM w/o breaking connection? / how does mscomm close port?

 

 
Powered by phpBB® Forum Software