Solved

Another Modem Question

Posted on 2001-07-21
11
390 Views
Last Modified: 2008-03-17
I am trying to dial a long number with an older modem.  I tried to use the following but buffers are not cleared and the second section gets an OK right away.  How can I clear the modem buffers before the second section?

' a is first part of number string and b is second part  
 DialString = "ATDT" + a + ";" + vbCr
   MSComm1.CommPort = Val(CommPort)
   MSComm1.Settings = "9600,N,8,1"
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
   MSComm1.Output = DialString
   Do
      DoEvents
   FromModem = FromModem & MSComm1.Input
   List1.AddItem FromModem
   Loop Until InStr(FromModem, "OK" & vbCrLf)
   List1.AddItem "finished"
   MSComm1.Output = "ATH" + ";" + vbCr
   MSComm1.PortOpen = False
   dummy = DoEvents
'-------
   DialString = "ATDT" + b + ";" + vbCr
   MSComm1.CommPort = Val(CommPort)
   MSComm1.Settings = "9600,N,8,1"
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
   MSComm1.Output = DialString
   Do
      DoEvents
   FromModem = FromModem & MSComm1.Input
   List1.AddItem FromModem
   Loop Until InStr(FromModem, "OK" & vbCrLf)
   List1.AddItem "finished"
   MSComm1.Output = "ATH" + ";" + vbCr
   MSComm1.PortOpen = False
   dummy = DoEvents
0
Comment
Question by:Lee5
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 17

Expert Comment

by:inthedark
ID: 6305582
Where do you clear FromModem?  When you hit the seconds loop it should be empty else it will pick up what was in there from before.
0
 

Author Comment

by:Lee5
ID: 6305600
That is my question - How do I empty the modem??
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6305648
I agree with dark. Do you have a line such as:

FromModem = ""

between those two sections? If you don't, then it will still contain the "OK" from the first loop.
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6305649
P.S. I doubt that you "empty the modem". Likely, when you read in the value, it's removed then.
0
 

Author Comment

by:Lee5
ID: 6305967
I put FromModem = "" 
between them but it does not clear the modem.  My list1 just keeps repeating the first number, so I know that the modem has not been cleared.

If I only use the first section, the modem dials fine.  I am trying to FIND OUT HOW TO CLEAR THE BUFFERS so I can dial the second part.  My phone is off the hook during the process so I won't lose the connection.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Accepted Solution

by:
KDivad earned 100 total points
ID: 6306208
The help file says this of the .Input method:

"Returns and removes characters from the receive buffer."

However, if the modem is likely to send back some codes that you simply want to ignore, you'll be interested in this:

"InBufferCount refers to the number of characters that have been received by the modem and are waiting in the receive buffer for you to take them out. You can clear the receive buffer by setting the InBufferCount property to 0."


Both entries are from the mscomm help file.
0
 

Author Comment

by:Lee5
ID: 6306264
I put
       MSComm1.InBufferCount = 0
      MSComm1.Input = 0
every place I could think of. - before closing comm1 in the first section and after opening comm1 in the second section.  The second loop still shows the number in the first loop.
I have read the help files and also have a Sams book on vb6 but can't find the specifics on clearing the buffers.
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6306974
You need to search your hard drive for the sample application VBTERM.VBP.

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6858519
Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20154837.html




PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 

Author Comment

by:Lee5
ID: 6859014
Sorry for the delay - I never got an email on this one.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6859095
Thank you for responding.  Please click your Member Profile to ensure that all the information there for you is correct.

Moondancer - EE Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now