Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create a phone dialler using the MS Comms Control

Tips -N- Tricks

How can I create a phone dialler using the MS Comms Control

by  ChrisRChamberlain  Posted    (Edited  )
You will need to add the Microsoft Communications Control to your form - find it in Tools -> Controls -> ActiveX controls.

The following code will need modifiying to suit your application, and can be used in the [color blue].Click()[/color] event of a commandbutton.

It assumes a modem on com port 2, and the reference to the port will need to be changed in the code for a port other than 2.

It also assumes a table containing the phone no, and if you need to dial a number to obtain an outside line, an example of the necessary code is also included.

Once the connection is made, the user has control of the phone line, and the program terminates.
[color blue]
WITH THISFORM.oleControl1
[tab].Enabled = .T.
[tab].sThreshold = 1
[tab].rThreshold = 1
[tab].CommPort = 2
[tab].PortOpen = .T.

[tab]IF EMPTY(USER.prefix)
[tab][tab].output = [ATDT] + ALLTRIM(CONTACTS.phone_no)+CHR(13)
[tab]ELSE
[tab][tab].output = [ATDT] + ALLTRIM(USER.prefix)+[,]+ALLTRIM(CONTACTS.phone_no) + CHR(13)
[tab]ENDIF

[tab]WAIT WINDOW ;
[tab][tab][Please press the handsfree button on the phone] ;
[tab][tab]+ CHR(13) ;
[tab][tab]+ [and then lift the receiver when the bell sounds.] ;
[tab][tab]TIMEOUT 5

[tab]SET BELL TO [sounds\ringin.WAV], 0
[tab]?? CHR(7)
[tab]SET BELL TO

[tab].output = [ATH0Z] + CHR(13)
[tab].sThreshold = 0
[tab].rThreshold = 0
[tab].PortOpen = .F.
[tab].CommPort = 1
[tab].Enabled = .F.
ENDW
[color black]
Happy talking! [talk]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top