home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1996 February / PCPRO_FEB96.ISO / code / vb / listing2.txt < prev    next >
Encoding:
Text File  |  1995-11-20  |  1.2 KB  |  55 lines

  1. frmPhoneDialler
  2.  
  3. General/Declarations
  4. Option Explicit
  5.  
  6. Private Sub cmdClosePort_Click()
  7. If MSComm.PortOpen = True Then
  8.     MSComm.PortOpen = False
  9. End If
  10. End Sub
  11.  
  12. Private Sub cmdDial_Click()
  13. On Error GoTo InvalidPort
  14. MSComm.CommPort = MyPort%
  15. MSComm.PortOpen = True
  16. If txtNumberToDial <> "" Then
  17.     MSComm.Settings = Trim$(BaudRate$ & "," & Parity$ & "," & DataBits$ & "," & StopBits$)
  18.     MSComm.Output = DialType$ & txtNumberToDial + Chr$(13)
  19. Else
  20.     MSComm.PortOpen = False
  21.     MsgBox "Please enter a number to dial."
  22. End If
  23. Exit Sub
  24. InvalidPort:
  25. MsgBox "Modem not found on the port you have currently selected."
  26. If MSComm.PortOpen = True Then
  27.     MSComm.PortOpen = False
  28. End If
  29. Exit Sub
  30. End Sub
  31.  
  32. Private Sub Form_Load()
  33. MsgBox "Default settings in use: Tone dialling, Com 1, 9600, N, 8, 1."
  34. DialType$ = "ATDT"
  35. MyPort% = 1
  36. BaudRate$ = "9600"
  37. Parity$ = "N"
  38. DataBits$ = "8"
  39. StopBits$ = "1"
  40. End Sub
  41.  
  42. Private Sub Form_Unload(Cancel As Integer)
  43. If MSComm.PortOpen = True Then
  44.     MSComm.PortOpen = False
  45. End If
  46. End Sub
  47.  
  48. Private Sub mnuCommSettings_Click()
  49. frmCommSettings.Show 1
  50. End Sub
  51.  
  52. Private Sub mnuExit_Click()
  53. End
  54. End Sub
  55.