Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dialing a phone in VFP 6.0
Message
From
10/10/1998 10:47:52
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00145584
Message ID:
00145666
Views:
34
>A client wants an app that'll run through their Leads table, and allow their telemarkets to dial the phone number in the current record.
>
>I've been looking at the MSCOMM32.OCX code example in Files here, and that might do it. However, I was wondering
>
>1) Does the person doing the calling need to take the phone off-hook, then click to dial the number?
>2) Are there any gotchas I neeed to be aware of?
>3) Is there any way to do this in native VFP code?
>4) Are there any add-ons that'll do this?
>
>Any help appreciated!

You can adapt this:
IF !( 'FOXTOOLS' $ UPPER(SET('LIBRARY')) )
    SET LIBRARY TO HOME() + "FOXTOOLS" ADDI
 ENDIF

LOCAL lccomport,lcdstring,lnport,lcfonelook

lccomport='COM2'
lcdstring = "ATDT " + m_fone + CHR(13)

opencomm  = RegFn("OpenComm", "CII", "I",'User.exe')
writecomm = RegFn("WriteComm", "ICI", "I",'User.exe')
closecomm = RegFn("CloseComm", "I", "I",'User.exe')

lnport = CallFn(OpenComm,lccomport, 100, 100)

=CallFn(WriteComm, lnport, lcdstring, len(lcdstring))

lcphonelook=IIF(m_fone='1','1 - '+PHONE(SUBS(m_fone,2)),PHONE(m_fone))
 =MESSAGEBOX('Dialing '+ALLT(lcphonelook)+CHR(13)+CHR(13)+;
 "Pick up the phone and press any key                  ",64)

lcdstring=CHR(10)+CHR(13)+CHR(10)+CHR(13)
=CallFn(WriteComm, lnport, lcdstring, len(lcdstring))
=CallFn(CloseComm, lnport)

PROCEDURE PHONE
 * Function to return a formatted string from a passed phone number

 PARA pphONE

 LOCAL lcretval
 lcretval=PADL(ALLT(pphONE),14)
 DO CASE
    CASE LEN(ALLT(pphONE))=7
       lcretval=SPAC(6)+SUBS(pphONE,1,3)+'-'+RIGH(pphONE,4)
    CASE LEN(ALLT(pphONE))=10
       lcretval='('+LEFT(pphONE,3)+') '+SUBS(pphONE,4,3)+'-'+RIGH(pphONE,4)
 ENDC
 RETU lcretval
This code doesn't pick up the phone for you though...
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform