INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Tips -N- Tricks

How can I create a phone dialler using the MS Comms Control by ChrisRChamberlain
Posted: 17 Aug 02

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 .Click() 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.

WITH THISFORM.oleControl1
    .Enabled = .T.
    .sThreshold = 1
    .rThreshold = 1
    .CommPort = 2
    .PortOpen = .T.

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

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

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

    .output = [ATH0Z] + CHR(13)    
    .sThreshold = 0
    .rThreshold = 0
    .PortOpen = .F.
    .CommPort = 1
    .Enabled = .F.
ENDW

Happy talking!

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close