home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap21 / frm421.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-24  |  6.2 KB  |  213 lines

  1. VERSION 4.00
  2. Begin VB.Form frmcomm 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   4140
  5.    ClientLeft      =   1905
  6.    ClientTop       =   1920
  7.    ClientWidth     =   5685
  8.    Height          =   4545
  9.    Left            =   1845
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4140
  12.    ScaleWidth      =   5685
  13.    Top             =   1575
  14.    Width           =   5805
  15.    Begin VB.CommandButton cmdHangUp 
  16.       Caption         =   "&Hang Up"
  17.       Height          =   395
  18.       Left            =   4380
  19.       TabIndex        =   13
  20.       Top             =   3480
  21.       Width           =   1215
  22.    End
  23.    Begin VB.ComboBox comParity 
  24.       Height          =   315
  25.       Left            =   3000
  26.       Style           =   2  'Dropdown List
  27.       TabIndex        =   12
  28.       Top             =   2880
  29.       Width           =   1755
  30.    End
  31.    Begin VB.ComboBox comStopBits 
  32.       Height          =   315
  33.       Left            =   3000
  34.       Style           =   2  'Dropdown List
  35.       TabIndex        =   11
  36.       Top             =   2400
  37.       Width           =   1755
  38.    End
  39.    Begin VB.ComboBox comDataBits 
  40.       Height          =   315
  41.       Left            =   3000
  42.       Style           =   2  'Dropdown List
  43.       TabIndex        =   10
  44.       Top             =   1920
  45.       Width           =   1755
  46.    End
  47.    Begin VB.ComboBox comLineSpeed 
  48.       Height          =   315
  49.       Left            =   3000
  50.       Style           =   2  'Dropdown List
  51.       TabIndex        =   6
  52.       Top             =   1440
  53.       Width           =   1755
  54.    End
  55.    Begin VB.ComboBox comCommPort 
  56.       Height          =   315
  57.       Left            =   3000
  58.       Style           =   2  'Dropdown List
  59.       TabIndex        =   4
  60.       Top             =   960
  61.       Width           =   1755
  62.    End
  63.    Begin VB.CommandButton cmdDial 
  64.       Caption         =   "&Dial"
  65.       Height          =   395
  66.       Left            =   2940
  67.       TabIndex        =   2
  68.       Top             =   3480
  69.       Width           =   1215
  70.    End
  71.    Begin VB.TextBox txtNumber 
  72.       Height          =   300
  73.       Left            =   3000
  74.       TabIndex        =   1
  75.       Top             =   480
  76.       Width           =   2355
  77.    End
  78.    Begin VB.Label lblParity 
  79.       Caption         =   "Parity"
  80.       Height          =   300
  81.       Left            =   420
  82.       TabIndex        =   9
  83.       Top             =   2880
  84.       Width           =   2175
  85.    End
  86.    Begin VB.Label lblStopBits 
  87.       Caption         =   "Stop Bits"
  88.       Height          =   300
  89.       Left            =   420
  90.       TabIndex        =   8
  91.       Top             =   2400
  92.       Width           =   2175
  93.    End
  94.    Begin VB.Label lblDataBits 
  95.       Caption         =   "Data Bits"
  96.       Height          =   300
  97.       Left            =   420
  98.       TabIndex        =   7
  99.       Top             =   1920
  100.       Width           =   2175
  101.    End
  102.    Begin VB.Label lbl_lineSpeed 
  103.       Caption         =   "Line Speed"
  104.       Height          =   300
  105.       Left            =   420
  106.       TabIndex        =   5
  107.       Top             =   1440
  108.       Width           =   2175
  109.    End
  110.    Begin VB.Label lblCommPort 
  111.       Caption         =   "Communication Port"
  112.       Height          =   300
  113.       Left            =   420
  114.       TabIndex        =   3
  115.       Top             =   960
  116.       Width           =   2175
  117.    End
  118.    Begin VB.Label lblNumber 
  119.       Caption         =   "Number To Dial"
  120.       Height          =   295
  121.       Left            =   420
  122.       TabIndex        =   0
  123.       Top             =   480
  124.       Width           =   2175
  125.    End
  126.    Begin MSCommLib.MSComm MSComm1 
  127.       Left            =   0
  128.       Top             =   0
  129.       _version        =   65536
  130.       _extentx        =   847
  131.       _extenty        =   847
  132.       _stockprops     =   0
  133.       cdtimeout       =   0
  134.       commport        =   1
  135.       ctstimeout      =   0
  136.       dsrtimeout      =   0
  137.       dtrenable       =   -1  'True
  138.       handshaking     =   0
  139.       inbuffersize    =   1024
  140.       inputlen        =   0
  141.       interval        =   1000
  142.       nulldiscard     =   0   'False
  143.       outbuffersize   =   512
  144.       parityreplace   =   "?"
  145.       rthreshold      =   0
  146.       rtsenable       =   0   'False
  147.       settings        =   "9600,n,8,1"
  148.       sthreshold      =   0
  149.    End
  150. Attribute VB_Name = "frmcomm"
  151. Attribute VB_Creatable = False
  152. Attribute VB_Exposed = False
  153. Option Explicit
  154. Private Sub Combo1_Change()
  155. End Sub
  156. Private Sub cmdDial_Click()
  157. If Len(comCommPort.TEXT) = 0 Then
  158.     MsgBox " You must Select a Communications Port prior to Dialing"
  159.     Exit Sub
  160. End If
  161. If Len(txtNumber.TEXT) = 0 Then
  162.     MsgBox " You Have Not Entered a Number Dial "
  163.     Exit Sub
  164. End If
  165. MSComm1.Settings = comLineSpeed.TEXT & "," & Mid$(comParity.TEXT, 1, 1) & "," & comDataBits.TEXT & "," & comStopBits.TEXT
  166. MSComm1.PortOpen = True
  167. MSComm1.Output = "ATDT" & "9," & txtNumber.TEXT & Chr$(13) ' Dial the requested number
  168. End Sub
  169. Private Sub cmdHangUp_Click()
  170. MSComm1.Output = "ATH0" + Chr$(13)
  171. MSComm1.PortOpen = False
  172. End Sub
  173. Private Sub comCommPort_Click()
  174. Select Case comCommPort.TEXT
  175.     Case "Com1:"
  176.         MSComm1.CommPort = 1
  177.     Case "Com2:"
  178.         MSComm1.CommPort = 2
  179.     Case "Com3:"
  180.         MSComm1.CommPort = 3
  181.     Case "Com4:"
  182.         MSComm1.CommPort = 4
  183. End Select
  184. End Sub
  185. Private Sub comDataBits_Change()
  186. End Sub
  187. Private Sub Form_Load()
  188. comCommPort.AddItem "Com1:"
  189. comCommPort.AddItem "Com2:"
  190. comCommPort.AddItem "Com3:"
  191. comCommPort.AddItem "Com4:"
  192. comDataBits.AddItem "8"
  193. comDataBits.AddItem "7"
  194. comLineSpeed.AddItem "19200"
  195. comLineSpeed.AddItem "14400"
  196. comLineSpeed.AddItem "9600"
  197. comLineSpeed.AddItem "4800"
  198. comLineSpeed.AddItem "2400"
  199. comLineSpeed.AddItem "1200"
  200. comParity.AddItem "N- None"
  201. comParity.AddItem "O - Odd"
  202. comParity.AddItem "E - Even"
  203. comParity.AddItem "E - Mark"
  204. comParity.AddItem "S - Space"
  205. comStopBits.AddItem "1"
  206. comStopBits.AddItem "1.5"
  207. comStopBits.AddItem "2"
  208. End Sub
  209. Private Sub MSComm1_OnComm()
  210. End Sub
  211. Private Sub txtNumber_Change()
  212. End Sub
  213.