home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / adialr / adialer.bas next >
Encoding:
BASIC Source File  |  1995-05-09  |  2.2 KB  |  71 lines

  1.  
  2. Sub DelNamIni ()
  3. 'Delete the [Name and Number] entries of old ADIALER.INI file
  4.     lpAppName$ = "Names and Numbers"
  5.     lpString$ = ""   'null string deletes existing value
  6.     lpFileName$ = "ADIALER.INI"
  7.     ListTotal% = TeleList.TeleListBox.ListCount 'gets number of entries in listbox
  8.  'Delete loop
  9.     Dim I As Integer
  10.     For I = 1 To ListTotal%
  11.         lpKeyName$ = "Name" + Str$(I)
  12.     WriteVar% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpString$, lpFileName$)
  13.     Next I
  14. End Sub
  15.  
  16. Sub Dial ()
  17.     CR$ = Chr$(13) + Chr$(10)
  18. 'Trim Name from List box string
  19.     PhoneStr$ = Right$(PhoneNum$, 15)
  20.     PhoneTrim$ = LTrim$(PhoneStr$)
  21. 'Open the Com Port
  22.     OpenCom% = OpenComm(ComNo$, 128, 64)
  23.     If OpenCom% < 0 Then
  24.         MsgBox "Couldn't open Com Port" + CR$ + "Check configuration!!"
  25.         Exit Sub
  26.     End If
  27. 'Add prefix to number if checkbox checked
  28.     If TeleList.PrefixCBox.Value = 1 Then
  29.         PhoneTrim$ = TeleList.PrefixTxtBox.Text + "," + PhoneTrim$
  30.     End If
  31. 'Dial the number
  32.     dialstring$ = "ATDT" + PhoneTrim$ + CR$
  33.     ModemWrite% = WriteComm(OpenCom%, dialstring$, 20)
  34. 'Pause loop
  35.     For I = 1 To 200
  36.         For I2 = 1 To 1000
  37.         Next I2
  38.     Next I
  39.     MsgBox "Pick up the phone and press Enter"
  40. 'Turn off modem
  41.     Break$ = "+++~~~ATH" + CR$
  42.     ModemOff% = WriteComm(OpenCom%, Break$, 20)
  43. If CloseComm(1) < 0 Then
  44.         MsgBox "Com port not closed"
  45.     End If
  46. End Sub
  47.  
  48. Function SetComPort (ComNo$)
  49.     lpAppName$ = "ComPort"
  50.     lpKeyName$ = "ComNo"
  51.     nSize% = 5
  52.     lpFileName$ = "ADIALER.INI"
  53.     WriteVar% = WritePrivateProfileString(lpAppName$, lpKeyName$, ComNo$, lpFileName$)
  54. End Function
  55.  
  56. Sub UpdateNamIni ()
  57.     lpAppName$ = "Names and Numbers"
  58.     lpFileName$ = "ADIALER.INI"
  59. 'Write new Names and Numbers from the listbox to ADIALER.INI
  60.     NewListTotal% = TeleList.TeleListBox.ListCount
  61. 'Update loop
  62.     Dim I2 As Integer
  63.     For I = 1 To NewListTotal%
  64.         I2 = I - 1   'corrects for listbox first entry as 0
  65.         lpKeyName$ = "Name" + Str$(I)
  66.         lpString$ = TeleList.TeleListBox.List(I2)
  67.         WriteVar% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpString$, lpFileName$)
  68.     Next I
  69. End Sub
  70.  
  71.