Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dialing a ordinary number
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00465007
Message ID:
00474558
Views:
7
I also am trying to dial an ordinary number from a form. I felt your attached code would be just what I was looking for. I have my modem on COM2, placed foxtools.fll in my application directory, the following code (except the function) in the click method for a command button, and the function in my main.prg. With debug enabled I find the code goes to the "opencomm =" line and my whole computer hangs and I have to turn it off and on again.

What am I doing wrong?

Thanks in advance

John

>* assume m_fone is the number to dial
>IF !( 'FOXTOOLS' $ UPPER(SET('LIBRARY')) )
> SET LIBRARY TO 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))
>lcfonelook=IIF(m_fone='1','1 - '+FONE(SUBS(m_fone,2)),FONE(m_fone))
>=MESSAGEBOX('Dialing '+ALLT(lcfonelook)+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 FONE
>* Function to return a formatted string from a passed phone number
>PARA tcFONE
>LOCAL lcretval
>lcretval=PADL(ALLT(tcFONE),14)
>DO CASE
>CASE LEN(ALLT(tcFONE))=7
>lcretval=SPAC(6)+SUBS(tcFONE,1,3)+'-'+RIGH(tcFONE,4)
>CASE LEN(ALLT(pFONE))=10
>lcretval='('+LEFT(tcFONE,3)+') '+SUBS(tcFONE,4,3)+'-'+RIGH(tcFONE,4)
>ENDC
>RETU lcretval
>* eop()
Previous
Reply
Map
View

Click here to load this message in the networking platform