Solved

VB5 Phone Dialer

Posted on 1997-05-02
3
174 Views
Last Modified: 2006-11-17
I have a screen which displays client information, including
the phone #. I want to dial this # when I press the dial label button. It should also give me relevant error messages. ( eg. line engaged, invalid # etc. ) Any source code and other information will be greatly apprecaited.
I am new to VB. Dilantha (-:
0
Comment
Question by:b3cf
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 100 total points
Comment Utility
VB 5.0 Pro/Ent comes with a sample application that does exactly what you want.Put an MSCOMM on your form, then add a push button that calls the following function:+----------+----------+
+----------+----------+
Private Sub Dial(Number$)
    Dim DialString$, FromModem$, dummy

    ' AT is the Hayes compatible ATTENTION command and is required to send commands to the modem.
    ' DT means "Dial Tone." The Dial command uses touch tones, as opposed to pulse (DP = Dial Pulse).
    ' Numbers$ is the phone number being dialed.
    ' A semicolon tells the modem to return to command mode after dialing (important).
    ' A carriage return, vbCr, is required when sending commands to the modem.
    DialString$ = "ATDT" + Number$ + ";" + vbCr

    ' Communications port settings.
    ' Assuming that a mouse is attached to COM1, CommPort is set to 2
    MSComm1.CommPort = 2
    MSComm1.Settings = "9600,N,8,1"
   
    ' Open the communications port.
    On Error Resume Next
    MSComm1.PortOpen = True
    If Err Then
       MsgBox "COM2: not available. Change the CommPort property to another port."
       Exit Sub
    End If
   
    ' Flush the input buffer.
    MSComm1.InBufferCount = 0
   
    ' Dial the number.
    MSComm1.Output = DialString$
   
    ' Wait for "OK" to come back from the modem.
    Do
       dummy = DoEvents()
       ' If there is data in the buffer, then read it.
       If MSComm1.InBufferCount Then
          FromModem$ = FromModem$ + MSComm1.Input
          ' Check for "OK".
          If InStr(FromModem$, "OK") Then
             ' Notify the user to pick up the phone.
             Beep
             MsgBox "Please pick up the phone and either press Enter or click OK"
             Exit Do
          End If
       End If
       
       ' Did the user choose Cancel?
       If CancelFlag Then
          CancelFlag = False
          Exit Do
       End If
    Loop
   
    ' Disconnect the modem.
    MSComm1.Output = "ATH" + vbCr
   
    ' Close the port.
    MSComm1.PortOpen = False
End Sub

0
 

Author Comment

by:b3cf
Comment Utility
Hi Chris,

Thanxx a lot for answering my question. I really
appreciate it.

Dilantha (-:

0
 

Author Comment

by:b3cf
Comment Utility
Hi Chris,

Thanxx a lot for answering my question. I really
appreciate it.

Dilantha (-:

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

728 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

15 Experts available now in Live!

Get 1:1 Help Now