home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SAMPLES.EXE / T_DIAL.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.9 KB  |  74 lines

  1. *****************************************************************
  2. * Test program for DIAL, DIALCLR functions ---  FILE T_DIAL.PRG
  3. *****************************************************************
  4.  
  5. * Copyright(c) 1991 -- James Occhiogrosso
  6.  
  7. * Demonstrate use of DIAL and DIALCLR
  8.  
  9. # include "inkey.ch"
  10.  
  11. LOCAL dial_ok := .F., keypress := 0, phone := SPACE(12),  ;
  12.       port := 1, tone := .T.
  13.  
  14. INITGLOBAL()
  15. SETCOLOR(colstd)
  16. CLEAR
  17.  
  18. DO WHILE keypress != K_ESC
  19.  
  20.     dial_ok = .F.
  21.     * Get dialing values
  22.  
  23.     @ 8, 15 SAY 'Enter desired values below, ' + ;
  24.                  'or press Esc to exit.'
  25.     @ 11, 18 SAY 'Telephone number to dial .... ' ;
  26.           GET phone PICTURE '999-999-9999'
  27.     @ 12, 18 SAY 'Communications port number .. ' ;
  28.           GET port PICTURE '9'
  29.     @ 13, 18 SAY 'Tone Dial? Y/N............... ' ;
  30.           GET tone PICTURE 'Y'
  31.  
  32.     READ
  33.  
  34.     IF LASTKEY() = K_ESC
  35.          QUIT
  36.     ENDIF
  37.  
  38.     * Test for telephone number entry
  39.  
  40.     IF EMPTY(STRTRAN(phone,'-'))
  41.         ERRORBEEP()
  42.         CENTERON(16, 'Please enter telephone number!')
  43.     ELSE
  44.         dial_ok = DIAL(phone, port, tone)
  45.     ENDIF
  46.  
  47.     * If DIAL returns true, wait 20 seconds for connection
  48.  
  49.     IF dial_ok
  50.         CENTERON(16, 'Dialing ... ' +                ;
  51.                IF(SUBSTR(LTRIM(phone),1,1) = '-',   ;
  52.                   SUBSTR(LTRIM(phone),2), phone) + ;
  53.            '.  Press any key when connection is made.')
  54.         keypress = INKEY(20)
  55.         DIALCLR()
  56.         @ 16, 0
  57.  
  58.  
  59.     * Otherwise, if telephone number was entered, display
  60.     * error message for port or modem.
  61.  
  62.     ELSEIF .NOT. EMPTY(STRTRAN(phone,'-'))
  63.         CENTERON(16, 'Communications port or modem' + ;
  64.                      ' not responding. Press any'   + ;
  65.                      ' key to try again.')
  66.         keypress = INKEY(0)
  67.         @ 16, 0
  68.  
  69.     ENDIF
  70.  
  71. ENDDO
  72.  
  73. RETURN NIL
  74.