Dialer program

I want to build a dialer program.
The user input the dialer string, and then the PC
check the modem status, and then dial.
The PC can know: the modem is ready? there is
a telephone tone? It dial success?  It is hanged up by remote
modem? the modem have connected to remote modem?

That means I want to dial and display the dialing status.

Please give me suggestion or sample code.
Who is Participating?
vettrangerConnect With a Mentor Commented:
To use a control that comes with VB, use the MSComm control. The OnComm event of this control will pretty much tell you all of the things you listed above. Here's the example for it :
Private Sub MSComm_OnComm ()
   Select Case MSComm1.CommEvent
   ' Handle each event or error by placing
   ' code below each case statement

   ' Errors
      Case comEventBreak   ' A Break was received.
      Case comEventFrame   ' Framing Error
      Case comEventOverrun   ' Data Lost.
      Case comEventRxOver   ' Receive buffer overflow.
      Case comEventRxParity   ' Parity Error.
      Case comEventTxFull   ' Transmit buffer full.
      Case comEventDCB   ' Unexpected error retrieving DCB]

   ' Events
      Case comEvCD   ' Change in the CD line.
      Case comEvCTS   ' Change in the CTS line.
      Case comEvDSR   ' Change in the DSR line.
      Case comEvRing   ' Change in the Ring Indicator.
      Case comEvReceive   ' Received RThreshold # of
                        ' chars.
      Case comEvSend   ' There are SThreshold number of
                     ' characters in the transmit
                     ' buffer.
      Case comEvEof   ' An EOF charater was found in
                     ' the input stream
   End Select
End Sub

The documentation for all these return codes, and all the MSComm events, is too long to list in a comment box, but this should get you to the right docs in VB Help to get your job done.
hxbAuthor Commented:
Thank for your help.
I have read the help, but still can not know how to

Can you give me a sample code ?
Your Visual Basic CD does have good sample projects for you. Following is the information on what they are named and how to find them :

Sample Applications: Dialer.vbp and VBTerm.vbp

The Dialer.vbp and VBTerm.vbp sample applications which are listed in the Samples directory, demonstrate simple and complex (respectively) programming techniques of the Communications control.

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

hxbAuthor Commented:
Thank for your help.

I have try the VBterm, and it is a good sample.

Now I have a problem, I can know that  the
CD is changed etc.
How can I sure that Dialer process is completed and I
can communicate now?
And how can I know the line is disconnected and must
dial again?
Where can I found more MSCOMM_Events description?

I believe you can use the Oncomm event, and check for a DTR status change. DTR will come up after the connect, and drop shortly before the disconnect.
hxbAuthor Commented:
how can I know if there is a device connected to the port I've assigned or the port is not available? Can you give me some codes on how can i know the port status?
All Courses

From novice to tech pro — start learning today.