Private Sub comm_OnComm()
Dim T As String
Dim i As Integer
i = comm.CommEvent
--comm.CommEvent=2 is data in input buffer
If i = 2 Then
If comm.InputLen > 0 Then
T = comm.Input
--Error reading com device - Error code 8020
ReadInputData T
End If
I can use the Hyper Terminal, and I know for certain that my modem is
working OK. All commands in the application has been tested out on the Hyper
Terminal !
Rgs,
Kjell
Err 8020 is not a normal serial port error. It is an Application Defined
error.
Your code:
If comm.InputLen > 0 Then
T = comm.Input
doesn't make sense. InputLen is a property that you SET to tell MSComm how
many characters to read (normally it is 0 -- there are few good reasons to
have it set to some other value). Thus, I suspect that you made a
transcription error?
I have lots of working code examples in my book (see below) that might help.
One issue that you may experience is a conflict with TAPI compatible
software. HyperTerminal is TAPI compliant, and can share a port with other
TAPI compliant applications, under some circumstances. If your SMS software
is using the port; that is if it is monitoring it for SMS receive messages,
HypterTerminal can use it too. However, MSComm is not TAPI compliant. It
cannot share a serial port with any other application. Make sure that no
other software is attempting to use the same serial port.
--
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.
My example:
Private Sub Comm1_OnComm()
Dim InString
Dim MyString
If Comm1.CommEvent = comEvReceive Then
'Incoming data
'Received Rthreshold number of characters.
'This event is generated continuously until
'you use the Input property to remove the
'data from the receive buffer.
'Clear receive buffer and assign to a variable
InString = Comm1.Input
--------Error 8020 reading port -----------------
'Assign "previously received" string to a variable
MyString = txtIn.Text
'Repopulate the TextBox with the old and new strings
txtIn.Text = MyString & InString
ShowErr 'Show errors, if there are any.
End If
End Sub
Here is another example:
"Christoph Guentner" <no.spa...@gmx.net> skrev i melding
news:#cfBjfIaBHA.1044@tkmsftngp05...
> Hi,
>
> I have written a VB/VBA program to access my mobile phone via Irda.
> This work fine under Windows 9x.
>
> With Windows 2000 I get an error when reading data from the inbuffer with
> 'InBuff = MSComm1.Input'. Opening the COM port the Irda is mapped and
> sendiung to does work.
> I have installed the Win2k service pack2 and the patch
> Q252795_W2k_sp3_x86_de.exe for to use Irda.
> When I use the Hyperterminal I can send and receive via Irda to/from my
> mobile.
> But when I do it with my VB/VBA program an error occurs: error no 8020:
> ('Error reading from the dial up device' or sth like that. I get a message
> in german)
> With a serial cable it works fine, and the same programs works with Irda
> under Windows 9x but not with Win2k and Irda.
> The settings of the com port,handshaking and the comport number are
correct
anybody an idea what the problem is?
thanx,
Fernando
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!