home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * Test program for DIAL, DIALCLR functions --- FILE T_DIAL.PRG
- *****************************************************************
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- * Demonstrate use of DIAL and DIALCLR
-
- # include "inkey.ch"
-
- LOCAL dial_ok := .F., keypress := 0, phone := SPACE(12), ;
- port := 1, tone := .T.
-
- INITGLOBAL()
- SETCOLOR(colstd)
- CLEAR
-
- DO WHILE keypress != K_ESC
-
- dial_ok = .F.
- * Get dialing values
-
- @ 8, 15 SAY 'Enter desired values below, ' + ;
- 'or press Esc to exit.'
- @ 11, 18 SAY 'Telephone number to dial .... ' ;
- GET phone PICTURE '999-999-9999'
- @ 12, 18 SAY 'Communications port number .. ' ;
- GET port PICTURE '9'
- @ 13, 18 SAY 'Tone Dial? Y/N............... ' ;
- GET tone PICTURE 'Y'
-
- READ
-
- IF LASTKEY() = K_ESC
- QUIT
- ENDIF
-
- * Test for telephone number entry
-
- IF EMPTY(STRTRAN(phone,'-'))
- ERRORBEEP()
- CENTERON(16, 'Please enter telephone number!')
- ELSE
- dial_ok = DIAL(phone, port, tone)
- ENDIF
-
- * If DIAL returns true, wait 20 seconds for connection
-
- IF dial_ok
- CENTERON(16, 'Dialing ... ' + ;
- IF(SUBSTR(LTRIM(phone),1,1) = '-', ;
- SUBSTR(LTRIM(phone),2), phone) + ;
- '. Press any key when connection is made.')
- keypress = INKEY(20)
- DIALCLR()
- @ 16, 0
-
-
- * Otherwise, if telephone number was entered, display
- * error message for port or modem.
-
- ELSEIF .NOT. EMPTY(STRTRAN(phone,'-'))
- CENTERON(16, 'Communications port or modem' + ;
- ' not responding. Press any' + ;
- ' key to try again.')
- keypress = INKEY(0)
- @ 16, 0
-
- ENDIF
-
- ENDDO
-
- RETURN NIL
-