home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 21.ddi / TERMSET.FR_ / TERMSET.bin (.txt)
Encoding:
Visual Basic Form  |  1993-02-14  |  13.9 KB  |  467 lines

  1. VERSION 2.00
  2. Begin Form ConfigScrn 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Communication Settings"
  5.    Height          =   4245
  6.    Icon            =   TERMSET.FRX:0000
  7.    Left            =   1050
  8.    LinkMode        =   1  'Source
  9.    LinkTopic       =   "Form3"
  10.    ScaleHeight     =   3840
  11.    ScaleWidth      =   4980
  12.    Top             =   1185
  13.    Width           =   5100
  14.    Begin OptionButton ComPort 
  15.       Caption         =   "Com1"
  16.       Height          =   252
  17.       Index           =   1
  18.       Left            =   1920
  19.       TabIndex        =   31
  20.       Top             =   2340
  21.       Width           =   852
  22.    End
  23.    Begin OptionButton ComPort 
  24.       Caption         =   "Com4"
  25.       Height          =   252
  26.       Index           =   4
  27.       Left            =   1920
  28.       TabIndex        =   30
  29.       Top             =   3240
  30.       Width           =   852
  31.    End
  32.    Begin OptionButton ComPort 
  33.       Caption         =   "Com3"
  34.       Height          =   252
  35.       Index           =   3
  36.       Left            =   1920
  37.       TabIndex        =   29
  38.       Top             =   2940
  39.       Width           =   852
  40.    End
  41.    Begin OptionButton ComPort 
  42.       Caption         =   "Com2"
  43.       Height          =   252
  44.       Index           =   2
  45.       Left            =   1920
  46.       TabIndex        =   28
  47.       Top             =   2640
  48.       Width           =   852
  49.    End
  50.    Begin Frame Frame1 
  51.       Caption         =   "&Baud Rate"
  52.       Height          =   975
  53.       Left            =   240
  54.       TabIndex        =   2
  55.       Top             =   120
  56.       Width           =   3315
  57.       Begin OptionButton Baud3 
  58.          Caption         =   "300"
  59.          Height          =   255
  60.          Left            =   300
  61.          TabIndex        =   3
  62.          Top             =   240
  63.          Width           =   735
  64.       End
  65.       Begin OptionButton Baud6 
  66.          Caption         =   "600"
  67.          Height          =   255
  68.          Left            =   1260
  69.          TabIndex        =   4
  70.          Top             =   240
  71.          Width           =   615
  72.       End
  73.       Begin OptionButton Baud12 
  74.          Caption         =   "1200"
  75.          Height          =   255
  76.          Left            =   2220
  77.          TabIndex        =   5
  78.          Top             =   240
  79.          Width           =   735
  80.       End
  81.       Begin OptionButton Baud24 
  82.          Caption         =   "2400"
  83.          Height          =   255
  84.          Left            =   300
  85.          TabIndex        =   6
  86.          Top             =   600
  87.          Width           =   735
  88.       End
  89.       Begin OptionButton Baud48 
  90.          Caption         =   "4800"
  91.          Height          =   255
  92.          Left            =   1260
  93.          TabIndex        =   7
  94.          Top             =   600
  95.          Width           =   735
  96.       End
  97.       Begin OptionButton Baud96 
  98.          Caption         =   "9600"
  99.          Height          =   255
  100.          Left            =   2220
  101.          TabIndex        =   8
  102.          Top             =   600
  103.          Width           =   735
  104.       End
  105.    End
  106.    Begin CommandButton OKButton 
  107.       Caption         =   "OK"
  108.       Default         =   -1  'True
  109.       Height          =   375
  110.       Left            =   3780
  111.       TabIndex        =   0
  112.       Top             =   240
  113.       Width           =   975
  114.    End
  115.    Begin CommandButton CancelButton 
  116.       Cancel          =   -1  'True
  117.       Caption         =   "Cancel"
  118.       Height          =   375
  119.       Left            =   3780
  120.       TabIndex        =   1
  121.       Top             =   720
  122.       Width           =   975
  123.    End
  124.    Begin Frame Frame2 
  125.       Caption         =   "&Data Bits"
  126.       Height          =   615
  127.       Left            =   240
  128.       TabIndex        =   9
  129.       Top             =   1260
  130.       Width           =   1275
  131.       Begin OptionButton Data7 
  132.          Caption         =   "7"
  133.          Height          =   255
  134.          Left            =   180
  135.          TabIndex        =   10
  136.          Top             =   240
  137.          Width           =   375
  138.       End
  139.       Begin OptionButton Data8 
  140.          Caption         =   "8"
  141.          Height          =   255
  142.          Left            =   720
  143.          TabIndex        =   11
  144.          Top             =   240
  145.          Width           =   435
  146.       End
  147.    End
  148.    Begin Frame Frame3 
  149.       Caption         =   "&Stop Bits"
  150.       Height          =   615
  151.       Left            =   1740
  152.       TabIndex        =   12
  153.       Top             =   1260
  154.       Width           =   1335
  155.       Begin OptionButton Stop1 
  156.          Caption         =   "1"
  157.          Height          =   255
  158.          Left            =   240
  159.          TabIndex        =   13
  160.          Top             =   240
  161.          Width           =   435
  162.       End
  163.       Begin OptionButton Stop2 
  164.          Caption         =   "2"
  165.          Height          =   255
  166.          Left            =   780
  167.          TabIndex        =   14
  168.          Top             =   240
  169.          Width           =   495
  170.       End
  171.    End
  172.    Begin Frame Frame7 
  173.       Caption         =   "&Echo"
  174.       Height          =   615
  175.       Left            =   3300
  176.       TabIndex        =   15
  177.       Top             =   1260
  178.       Width           =   1455
  179.       Begin OptionButton EchoOff 
  180.          Caption         =   "Off"
  181.          Height          =   315
  182.          Left            =   780
  183.          TabIndex        =   17
  184.          Top             =   240
  185.          Width           =   615
  186.       End
  187.       Begin OptionButton EchoOn 
  188.          Caption         =   "On"
  189.          Height          =   195
  190.          Left            =   180
  191.          TabIndex        =   16
  192.          Top             =   300
  193.          Width           =   555
  194.       End
  195.    End
  196.    Begin Frame Frame4 
  197.       Caption         =   "&Parity"
  198.       Height          =   1575
  199.       Left            =   240
  200.       TabIndex        =   18
  201.       Top             =   2040
  202.       Width           =   1275
  203.       Begin OptionButton NoParity 
  204.          Caption         =   "None"
  205.          Height          =   255
  206.          Left            =   180
  207.          TabIndex        =   19
  208.          Top             =   300
  209.          Width           =   855
  210.       End
  211.       Begin OptionButton OddParity 
  212.          Caption         =   "Odd"
  213.          Height          =   255
  214.          Left            =   180
  215.          TabIndex        =   20
  216.          Top             =   600
  217.          Width           =   735
  218.       End
  219.       Begin OptionButton EvenParity 
  220.          Caption         =   "Even"
  221.          Height          =   255
  222.          Left            =   180
  223.          TabIndex        =   21
  224.          Top             =   900
  225.          Width           =   855
  226.       End
  227.    End
  228.    Begin Frame Frame6 
  229.       Caption         =   "&Com Port"
  230.       Height          =   1575
  231.       Left            =   1740
  232.       TabIndex        =   22
  233.       Top             =   2040
  234.       Width           =   1335
  235.    End
  236.    Begin Frame Frame5 
  237.       Caption         =   "&Flow Control"
  238.       Height          =   1575
  239.       Left            =   3300
  240.       TabIndex        =   23
  241.       Top             =   2040
  242.       Width           =   1455
  243.       Begin OptionButton NoFlow 
  244.          Caption         =   "None"
  245.          Height          =   255
  246.          Left            =   180
  247.          TabIndex        =   26
  248.          Top             =   300
  249.          Width           =   855
  250.       End
  251.       Begin OptionButton XonFlow 
  252.          Caption         =   "Xon/Xoff"
  253.          Height          =   255
  254.          Left            =   180
  255.          TabIndex        =   24
  256.          Top             =   600
  257.          Width           =   1095
  258.       End
  259.       Begin OptionButton RTSFlow 
  260.          Caption         =   "RTS"
  261.          Height          =   255
  262.          Left            =   180
  263.          TabIndex        =   25
  264.          Top             =   900
  265.          Width           =   735
  266.       End
  267.       Begin OptionButton BothFlow 
  268.          Caption         =   "Xon/RTS"
  269.          Height          =   255
  270.          Left            =   180
  271.          TabIndex        =   27
  272.          Top             =   1200
  273.          Width           =   1155
  274.       End
  275.    End
  276. '***********  Communication Settings Configuration Form
  277. 'Copyright (c) 1991, Crescent Software
  278. DefInt A-Z
  279. Dim Shared NewPort                 'temp config settings
  280. Dim Shared NewBaud$, NewParity$
  281. Dim Shared NewData$, NewStop$
  282. Dim Shared NewShake
  283. '--- 1200 baud option button
  284. Sub Baud12_Click ()
  285.     NewBaud$ = "1200"
  286. End Sub
  287. '--- 2400 baud option button
  288. Sub Baud24_Click ()
  289.     NewBaud$ = "2400"
  290. End Sub
  291. '--- 300 baud option button
  292. Sub Baud3_Click ()
  293.     NewBaud$ = "300"
  294. End Sub
  295. '--- 4800 baud option button
  296. Sub Baud48_Click ()
  297.     NewBaud$ = "4800"
  298. End Sub
  299. '--- 600 baud option button
  300. Sub Baud6_Click ()
  301.     NewBaud$ = "600"
  302. End Sub
  303. '--- 9600 baud option button
  304. Sub Baud96_Click ()
  305.     NewBaud$ = "9600"
  306. End Sub
  307. '--- Both RTS and Xon/Xoff handshaking option button
  308. Sub BothFlow_Click ()
  309.     NewShake = 3
  310. End Sub
  311. '--- Cancel button actions
  312. Sub CancelButton_Click ()
  313.     Unload ConfigScrn
  314. End Sub
  315. Sub ComPort_Click (Index As Integer)
  316.     NewPort = Index
  317. End Sub
  318. '--- 7 data bits option button
  319. Sub Data7_Click ()
  320.     NewData$ = "7"
  321. End Sub
  322. '--- 8 data bits option button
  323. Sub Data8_Click ()
  324.     NewData$ = "8"
  325. End Sub
  326. '--- Echo off option button
  327. Sub EchoOff_Click ()
  328.     Echo = 0
  329. End Sub
  330. '--- Echo on option button
  331. Sub EchoOn_Click ()
  332.     Echo = True
  333. End Sub
  334. '--- Even parity option button
  335. Sub EvenParity_Click ()
  336.     NewParity$ = "E"
  337. End Sub
  338. '--- Initialize and display configuration form
  339. Sub Form_Load ()
  340.     '--- Get current port
  341.     Port = Form1.MSComm1.CommPort
  342.     ConfigScrn.ComPort(Port).Value = True       'Set option button
  343.     '--- Get current baud
  344.     FirstComma = InStr(Form1.MSComm1.Settings, ",")
  345.     Baud$ = Left$(Form1.MSComm1.Settings, FirstComma - 1)
  346.     Select Case Val(Baud$)                  'select baud
  347.     Case 300                                'set active baud
  348.         ConfigScrn.Baud3.Value = True       'option button
  349.     Case 600
  350.         ConfigScrn.Baud6.Value = True
  351.     Case 1200
  352.         ConfigScrn.Baud12.Value = True
  353.     Case 2400
  354.         ConfigScrn.Baud24.Value = True
  355.     Case 4800
  356.         ConfigScrn.Baud48.Value = True
  357.     Case 9600
  358.         ConfigScrn.Baud96.Value = True
  359.     End Select
  360.     '--- Get current parity
  361.     Parity$ = Mid$(Form1.MSComm1.Settings, FirstComma + 1, 1)
  362.     Select Case UCase$(Parity$)             'select parity
  363.     Case "N"                                'set active parity
  364.         ConfigScrn.NoParity.Value = True    'option button
  365.     Case "E"
  366.         ConfigScrn.EvenParity.Value = True
  367.     Case "O"
  368.         ConfigScrn.OddParity.Value = True
  369.     End Select
  370.     '--- Get data bits
  371.     SecondComma = FirstComma + 2
  372.     DBits$ = Mid$(Form1.MSComm1.Settings, SecondComma + 1, 1)
  373.     Select Case Val(DBits$)              'select data bits
  374.     Case 7                              'set active choice
  375.         ConfigScrn.Data7.Value = True       'option button
  376.     Case 8
  377.         ConfigScrn.Data8.Value = True
  378.     End Select
  379.     '--- Get stop bits
  380.     ThirdComma = SecondComma + 2
  381.     SBits$ = Mid$(Form1.MSComm1.Settings, ThirdComma + 1, 1)
  382.     Select Case Val(SBits$)                 'select stop bits
  383.     Case 1                                  'set active choice
  384.         ConfigScrn.Stop1.Value = True       'option button
  385.     Case 2
  386.         ConfigScrn.Stop2.Value = True
  387.     End Select
  388.     Select Case Form1.MSComm1.Handshaking
  389.     Case 0                                  'set active choice
  390.         ConfigScrn.NoFlow.Value = True      'option button
  391.     Case 1
  392.         ConfigScrn.XonFlow.Value = True
  393.     Case 2
  394.         ConfigScrn.RTSFlow.Value = True
  395.     Case 3
  396.         ConfigScrn.BothFlow.Value = True
  397.     End Select
  398.     If Echo Then
  399.         ConfigScrn.EchoOn.Value = True
  400.     Else
  401.         ConfigScrn.EchoOff.Value = True
  402.     End If
  403. End Sub
  404. '--- No handshaking option button
  405. Sub NoFlow_Click ()
  406.     NewShake = 0
  407. End Sub
  408. '--- No parity option button
  409. Sub NoParity_Click ()
  410.     NewParity$ = "N"
  411. End Sub
  412. '--- Odd parity option button
  413. Sub OddParity_Click ()
  414.     NewParity$ = "O"
  415. End Sub
  416. '--- Ok button actions
  417. Sub OkButton_Click ()
  418.     On Error Resume Next
  419.     OldPort = Form1.MSComm1.CommPort
  420.     If NewPort <> OldPort Then                    'if port num changing
  421.         If Form1.MSComm1.PortOpen Then            'close the old port
  422.            Form1.MSComm1.PortOpen = False
  423.            ReOpen = True
  424.         End If
  425.         Form1.MSComm1.CommPort = NewPort          'set new port number
  426.         If Err = 0 Then
  427.            If ReOpen Then
  428.               Form1.MSComm1.PortOpen = True
  429.               Form1.MOpen.Checked = Form1.MSComm1.PortOpen
  430.               Form1.MSendText.Enabled = Form1.MSComm1.PortOpen
  431.            End If
  432.         End If
  433.         If Err Then
  434.            MsgBox Error$, 48
  435.            Form1.MSComm1.CommPort = OldPort
  436.            Exit Sub
  437.         End If
  438.     End If
  439.     Form1.MSComm1.Settings = NewBaud$ + "," + NewParity$ + "," + NewData$ + "," + NewStop$
  440.     If Err Then
  441.        MsgBox Error$, 48
  442.        Exit Sub
  443.     End If
  444.     Form1.MSComm1.Handshaking = NewShake
  445.     If Err Then
  446.        MsgBox Error$, 48
  447.        Exit Sub
  448.     End If
  449.     Unload ConfigScrn                               'remove configuration form
  450. End Sub
  451. '--- RTS handshaking option button
  452. Sub RTSFlow_Click ()
  453.     NewShake = 2
  454. End Sub
  455. '--- 1 stop bit option button
  456. Sub Stop1_Click ()
  457.     NewStop$ = "1"
  458. End Sub
  459. '--- 2 stop bits option button
  460. Sub Stop2_Click ()
  461.     NewStop$ = "2"
  462. End Sub
  463. '--- XON handshaking option button
  464. Sub XonFlow_Click ()
  465.     NewShake = 1
  466. End Sub
  467.