home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 May / cica_0595_4.zip / cica_0595_4 / UTIL / WSPRTERM / COMMSETT.FRM next >
Text File  |  1994-05-01  |  17KB  |  612 lines

  1. VERSION 2.00
  2. Begin Form CommSettings 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Async Communications Settings"
  6.    ClientHeight    =   3615
  7.    ClientLeft      =   825
  8.    ClientTop       =   1545
  9.    ClientWidth     =   8085
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    Height          =   4080
  13.    Left            =   735
  14.    LinkTopic       =   "Form2"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   3615
  18.    ScaleWidth      =   8085
  19.    Top             =   1170
  20.    Visible         =   0   'False
  21.    Width           =   8265
  22.    Begin SSPanel Panel3D2 
  23.       BevelOuter      =   1  'Inset
  24.       BevelWidth      =   5
  25.       BorderWidth     =   2
  26.       ForeColor       =   &H00FFFFFF&
  27.       Height          =   2895
  28.       Left            =   4365
  29.       TabIndex        =   18
  30.       Top             =   90
  31.       Width           =   3615
  32.       Begin SSFrame CSDataBits 
  33.          Caption         =   "Data Bits"
  34.          Height          =   690
  35.          Left            =   1755
  36.          TabIndex        =   29
  37.          Top             =   315
  38.          Width           =   1545
  39.          Begin SSOption LData7 
  40.             Caption         =   "7"
  41.             Height          =   330
  42.             Left            =   900
  43.             TabIndex        =   31
  44.             TabStop         =   0   'False
  45.             Top             =   270
  46.             Width           =   555
  47.          End
  48.          Begin SSOption LData8 
  49.             Caption         =   "8"
  50.             Height          =   240
  51.             Left            =   270
  52.             TabIndex        =   30
  53.             Top             =   315
  54.             Value           =   -1  'True
  55.             Width           =   510
  56.          End
  57.       End
  58.       Begin SSFrame CSStopBits 
  59.          Caption         =   "Stop Bits"
  60.          Height          =   1365
  61.          Left            =   2070
  62.          TabIndex        =   25
  63.          Top             =   1170
  64.          Width           =   960
  65.          Begin SSOption LStop2 
  66.             Caption         =   "2"
  67.             Height          =   285
  68.             Left            =   225
  69.             TabIndex        =   28
  70.             TabStop         =   0   'False
  71.             Top             =   990
  72.             Width           =   555
  73.          End
  74.          Begin SSOption LStop15 
  75.             Caption         =   "1.5"
  76.             Height          =   240
  77.             Left            =   225
  78.             TabIndex        =   27
  79.             TabStop         =   0   'False
  80.             Top             =   675
  81.             Width           =   555
  82.          End
  83.          Begin SSOption LStop1 
  84.             Caption         =   "1"
  85.             Height          =   240
  86.             Left            =   225
  87.             TabIndex        =   26
  88.             Top             =   360
  89.             Value           =   -1  'True
  90.             Width           =   555
  91.          End
  92.       End
  93.       Begin SSFrame CSParity 
  94.          Caption         =   "Parity"
  95.          Height          =   2220
  96.          Left            =   315
  97.          TabIndex        =   19
  98.          Top             =   315
  99.          Width           =   1230
  100.          Begin SSOption LParityS 
  101.             Caption         =   "Space"
  102.             Height          =   285
  103.             Left            =   180
  104.             TabIndex        =   24
  105.             TabStop         =   0   'False
  106.             Top             =   1755
  107.             Width           =   915
  108.          End
  109.          Begin SSOption LParityM 
  110.             Caption         =   "Mark"
  111.             Height          =   285
  112.             Left            =   180
  113.             TabIndex        =   23
  114.             TabStop         =   0   'False
  115.             Top             =   1395
  116.             Width           =   960
  117.          End
  118.          Begin SSOption LParityO 
  119.             Caption         =   "Odd"
  120.             Height          =   240
  121.             Left            =   180
  122.             TabIndex        =   22
  123.             TabStop         =   0   'False
  124.             Top             =   1035
  125.             Width           =   915
  126.          End
  127.          Begin SSOption LParityE 
  128.             Caption         =   "Even"
  129.             Height          =   240
  130.             Left            =   180
  131.             TabIndex        =   21
  132.             TabStop         =   0   'False
  133.             Top             =   675
  134.             Width           =   960
  135.          End
  136.          Begin SSOption LParityN 
  137.             Caption         =   "None"
  138.             Height          =   240
  139.             Left            =   180
  140.             TabIndex        =   20
  141.             Top             =   315
  142.             Value           =   -1  'True
  143.             Width           =   1005
  144.          End
  145.       End
  146.    End
  147.    Begin SSPanel Panel3D1 
  148.       BevelOuter      =   1  'Inset
  149.       BevelWidth      =   5
  150.       BorderWidth     =   1
  151.       ForeColor       =   &H00FFFFFF&
  152.       Height          =   2895
  153.       Left            =   90
  154.       TabIndex        =   2
  155.       Top             =   90
  156.       Width           =   4065
  157.       Begin SSFrame CSFlowControl 
  158.          Caption         =   "Flow Control"
  159.          Height          =   1230
  160.          Left            =   1800
  161.          TabIndex        =   5
  162.          Top             =   1395
  163.          Width           =   1950
  164.          Begin SSOption LFlowXonXoff 
  165.             Caption         =   "XON/XOFF"
  166.             Height          =   195
  167.             Left            =   180
  168.             TabIndex        =   17
  169.             TabStop         =   0   'False
  170.             Top             =   900
  171.             Width           =   1320
  172.          End
  173.          Begin SSOption LFlowRtsCts 
  174.             Caption         =   "RTS/CTS"
  175.             Height          =   195
  176.             Left            =   180
  177.             TabIndex        =   16
  178.             Top             =   630
  179.             Value           =   -1  'True
  180.             Width           =   1455
  181.          End
  182.          Begin SSOption LFlowNone 
  183.             Caption         =   "None"
  184.             Height          =   240
  185.             Left            =   180
  186.             TabIndex        =   15
  187.             TabStop         =   0   'False
  188.             Top             =   315
  189.             Width           =   1455
  190.          End
  191.       End
  192.       Begin SSFrame CSCommPort 
  193.          Caption         =   "Comm Port"
  194.          Height          =   1095
  195.          Left            =   1665
  196.          TabIndex        =   4
  197.          Top             =   180
  198.          Width           =   2175
  199.          Begin SSOption LCom4 
  200.             Caption         =   "COM4"
  201.             Height          =   195
  202.             Left            =   1170
  203.             TabIndex        =   14
  204.             TabStop         =   0   'False
  205.             Top             =   720
  206.             Width           =   825
  207.          End
  208.          Begin SSOption LCom2 
  209.             Caption         =   "COM2"
  210.             Height          =   195
  211.             Left            =   180
  212.             TabIndex        =   13
  213.             Top             =   720
  214.             Value           =   -1  'True
  215.             Width           =   870
  216.          End
  217.          Begin SSOption LCom3 
  218.             Caption         =   "COM3"
  219.             Height          =   240
  220.             Left            =   1170
  221.             TabIndex        =   12
  222.             TabStop         =   0   'False
  223.             Top             =   360
  224.             Width           =   825
  225.          End
  226.          Begin SSOption LCom1 
  227.             Caption         =   "COM1"
  228.             Height          =   240
  229.             Left            =   180
  230.             TabIndex        =   11
  231.             TabStop         =   0   'False
  232.             Top             =   360
  233.             Width           =   825
  234.          End
  235.       End
  236.       Begin SSFrame CSBaudRate 
  237.          Caption         =   "Baud Rate"
  238.          Height          =   2355
  239.          Left            =   225
  240.          TabIndex        =   3
  241.          Top             =   225
  242.          Width           =   1230
  243.          Begin SSOption LBaud12 
  244.             Caption         =   "1200"
  245.             Height          =   240
  246.             Left            =   180
  247.             TabIndex        =   10
  248.             TabStop         =   0   'False
  249.             Top             =   1935
  250.             Width           =   915
  251.          End
  252.          Begin SSOption LBaud24 
  253.             Caption         =   "2400"
  254.             Height          =   195
  255.             Left            =   180
  256.             TabIndex        =   9
  257.             TabStop         =   0   'False
  258.             Top             =   1575
  259.             Width           =   870
  260.          End
  261.          Begin SSOption LBaud48 
  262.             Caption         =   "4800"
  263.             Height          =   195
  264.             Left            =   180
  265.             TabIndex        =   8
  266.             TabStop         =   0   'False
  267.             Top             =   1170
  268.             Width           =   960
  269.          End
  270.          Begin SSOption LBaud96 
  271.             Caption         =   "9600"
  272.             Height          =   195
  273.             Left            =   180
  274.             TabIndex        =   7
  275.             Top             =   765
  276.             Value           =   -1  'True
  277.             Width           =   960
  278.          End
  279.          Begin SSOption LBaud192 
  280.             Caption         =   "19200"
  281.             Height          =   240
  282.             Left            =   180
  283.             TabIndex        =   6
  284.             TabStop         =   0   'False
  285.             Top             =   315
  286.             Width           =   915
  287.          End
  288.       End
  289.    End
  290.    Begin CommandButton CommSetOk 
  291.       Caption         =   "&Ok"
  292.       Default         =   -1  'True
  293.       Height          =   375
  294.       Left            =   3150
  295.       TabIndex        =   0
  296.       Top             =   3105
  297.       Width           =   1095
  298.    End
  299.    Begin CommandButton CommSetCancel 
  300.       Cancel          =   -1  'True
  301.       Caption         =   "&Cancel"
  302.       Height          =   375
  303.       Left            =   4320
  304.       TabIndex        =   1
  305.       Top             =   3105
  306.       Width           =   1095
  307.    End
  308. End
  309. Dim newParity As String
  310. Dim newDataBits As String
  311. Dim newstopBits As String
  312.  
  313. Dim newCommPort As Integer
  314. Dim newBaudRate As String
  315. Dim newHandShake As Integer
  316.  
  317. Sub CommSetCancel_Click ()
  318.  
  319.     'FMain.Enabled = True
  320.     'FMain.SetFocus
  321.     Unload commSettings
  322.  
  323. End Sub
  324.  
  325. Sub CommSetOk_Click ()
  326.     Dim curPortState%, rv%
  327.  
  328.     curConnectType = CT_Async
  329.  
  330.     curBaudRate = newBaudRate
  331.     curCommPort = newCommPort
  332.     curHandShake = newHandShake
  333.  
  334.     curParity = newParity
  335.     curDataBits = newDataBits
  336.     curStopBits = newstopBits
  337.  
  338.     rv = WritePrivateProfileString(Key_Notes, Appl_ConnectType, Str$(curConnectType), DefaultINI)
  339.     rv = WritePrivateProfileString(Key_Async, Appl_CommPort, Str$(curCommPort), DefaultINI)
  340.     rv = WritePrivateProfileString(Key_Async, Appl_HandShake, Str$(curHandShake), DefaultINI)
  341.     rv = WritePrivateProfileString(Key_Async, Appl_BaudRate, curBaudRate, DefaultINI)
  342.     rv = WritePrivateProfileString(Key_Async, Appl_Parity, curParity, DefaultINI)
  343.     rv = WritePrivateProfileString(Key_Async, Appl_Databits, curDataBits, DefaultINI)
  344.     rv = WritePrivateProfileString(Key_Async, Appl_Stopbits, curStopBits, DefaultINI)
  345.     rv = WritePrivateProfileString(Key_Async, Appl_OutBufSize, Str$(asyncOutBufSize), DefaultINI)
  346.     rv = WritePrivateProfileString(Key_Async, Appl_InBufSize, Str$(asyncInBufSize), DefaultINI)
  347.     rv = WritePrivateProfileString(Key_Async, Appl_Interval, Str$(asyncPollInterval), DefaultINI)
  348.  
  349.     curPortState = FMain.CommPort.PortOpen
  350.     'Cannot set PortOpen property to FALSE unless it's TRUE
  351.     If FMain.CommPort.PortOpen Then
  352.         FMain.CommPort.PortOpen = False
  353.     End If
  354.  
  355.     FMain.CommPort.Settings = curBaudRate & "," & curParity & "," & curDataBits & "," & curStopBits
  356.     FMain.CommPort.CommPort = curCommPort
  357.     FMain.CommPort.Handshaking = curHandShake
  358.     FMain.StatusPanel.Caption = "COM" & FMain.CommPort.CommPort & ":" & FMain.CommPort.Settings
  359.  
  360.     'As above, cannot set PortOpen property to FALSE unless it's TRUE
  361.     If curPortState = True Then
  362.         FMain.CommPort.PortOpen = curPortState
  363.     End If
  364.  
  365.     'FMain.Enabled = True
  366.     'FMain.SetFocus
  367.     Unload commSettings
  368.  
  369. End Sub
  370.  
  371. Sub Form_Load ()
  372.  
  373.     CenterForm commSettings
  374.  
  375.     Select Case curBaudRate
  376.         Case "19200"
  377.             LBaud192.Value = True
  378.         Case "9600"
  379.             LBaud96.Value = True
  380.         Case "4800"
  381.             LBaud48.Value = True
  382.         Case "2400"
  383.             LBaud24.Value = True
  384.         Case "1200"
  385.             LBaud12.Value = True
  386.         Case Else
  387.             LBaud96.Value = True
  388.             curBaudRate = "9600"
  389.     End Select
  390.     newBaudRate = curBaudRate
  391.  
  392.     Select Case curCommPort
  393.         Case 1
  394.             LCom1.Value = True
  395.         Case 2
  396.             LCom2.Value = True
  397.         Case 3
  398.             LCom3.Value = True
  399.         Case 4
  400.             LCom4.Value = True
  401.         Case Else
  402.             LCom2.Value = True
  403.             curCommPort = 2
  404.     End Select
  405.     newCommPort = curCommPort
  406.     
  407.     Select Case curHandShake
  408.         Case 1
  409.             LFlowXonXoff.Value = True
  410.         Case 2
  411.             LFlowRtsCts.Value = True
  412.         Case Else
  413.             LFlowNone.Value = True
  414.             curHandShake = 0
  415.     End Select
  416.     newHandShake = curHandShake
  417.  
  418.     Select Case curParity
  419.         Case "N", "n"
  420.             LParityN.Value = True
  421.         Case "E", "e"
  422.             LParityE.Value = True
  423.         Case "O", "o"
  424.             LParityO.Value = True
  425.         Case "M", "m"
  426.             LParityM.Value = True
  427.         Case "S", "s"
  428.             LParityS.Value = True
  429.         Case Else
  430.             LParityN.Value = True
  431.             curParity = "N"
  432.     End Select
  433.     newParity = curParity
  434.  
  435.     If curDataBits = "7" Then
  436.         LData7.Value = True
  437.     Else
  438.         LData8.Value = True
  439.         curDataBits = "8"
  440.     End If
  441.     newDataBits = curDataBits
  442.  
  443.     Select Case curStopBits
  444.         Case "1"
  445.             LStop1.Value = True
  446.         Case "1.5"
  447.             LStop15.Value = True
  448.         Case "2"
  449.             LStop2.Value = True
  450.         Case Else
  451.             LStop1.Value = True
  452.             curStopBits = "1"
  453.     End Select
  454.     newstopBits = curStopBits
  455.  
  456. End Sub
  457.  
  458. Sub LBaud12_Click (Value As Integer)
  459.  
  460.     'If Value Then
  461.     newBaudRate = "1200"
  462.  
  463. End Sub
  464.  
  465. Sub LBaud192_Click (Value As Integer)
  466.  
  467.     'If Value Then
  468.     newBaudRate = "19200"
  469.  
  470. End Sub
  471.  
  472. Sub LBaud24_Click (Value As Integer)
  473.  
  474.     'If Value Then
  475.     newBaudRate = "2400"
  476.  
  477. End Sub
  478.  
  479. Sub LBaud48_Click (Value As Integer)
  480.  
  481.     'If Value Then
  482.     newBaudRate = "4800"
  483.  
  484. End Sub
  485.  
  486. Sub LBaud96_Click (Value As Integer)
  487.  
  488.     'If Value Then
  489.     newBaudRate = "9600"
  490.  
  491. End Sub
  492.  
  493. Sub LCom1_Click (Value As Integer)
  494.  
  495.     'If Value Then
  496.     newCommPort = 1
  497.  
  498. End Sub
  499.  
  500. Sub LCom2_Click (Value As Integer)
  501.  
  502.     'If Value Then
  503.     newCommPort = 2
  504.  
  505. End Sub
  506.  
  507. Sub LCom3_Click (Value As Integer)
  508.  
  509.     'If Value Then
  510.     newCommPort = 3
  511.  
  512. End Sub
  513.  
  514. Sub LCom4_Click (Value As Integer)
  515.  
  516.     'If Value Then
  517.     newCommPort = 4
  518.  
  519. End Sub
  520.  
  521. Sub LData7_Click (Value As Integer)
  522.  
  523.     newDataBits = "7"
  524.  
  525. End Sub
  526.  
  527. Sub LData8_Click (Value As Integer)
  528.  
  529.     newDataBits = "8"
  530.  
  531. End Sub
  532.  
  533. Sub LFlowNone_Click (Value As Integer)
  534.  
  535.     'If Value Then
  536.     newHandShake = 0
  537.  
  538. End Sub
  539.  
  540. Sub LFlowRtsCts_Click (Value As Integer)
  541.  
  542.     'If Value Then
  543.     newHandShake = 2
  544.  
  545. End Sub
  546.  
  547. Sub LFlowXonXoff_Click (Value As Integer)
  548.  
  549.     'If Value Then
  550.     newHandShake = 1
  551.  
  552. End Sub
  553.  
  554. Sub LParityE_Click (Value As Integer)
  555.  
  556.     newParity = "E"
  557.     LData7.Value = True
  558.     newDataBits = "7"
  559.  
  560. End Sub
  561.  
  562. Sub LParityM_Click (Value As Integer)
  563.  
  564.     newParity = "M"
  565.     LData7.Value = True
  566.     newDataBits = "7"
  567.  
  568. End Sub
  569.  
  570. Sub LParityN_Click (Value As Integer)
  571.  
  572.     newParity = "N"
  573.     LData8.Value = True
  574.     newDataBits = "8"
  575.  
  576. End Sub
  577.  
  578. Sub LParityO_Click (Value As Integer)
  579.  
  580.     newParity = "O"
  581.     LData7.Value = True
  582.     newDataBits = "7"
  583.  
  584. End Sub
  585.  
  586. Sub LParityS_Click (Value As Integer)
  587.  
  588.     newParity = "S"
  589.     LData7.Value = True
  590.     newDataBits = "7"
  591.  
  592. End Sub
  593.  
  594. Sub LStop1_Click (Value As Integer)
  595.  
  596.     newstopBits = "1"
  597.  
  598. End Sub
  599.  
  600. Sub LStop15_Click (Value As Integer)
  601.  
  602.     newstopBits = "1.5"
  603.  
  604. End Sub
  605.  
  606. Sub LStop2_Click (Value As Integer)
  607.  
  608.     newstopBits = "2"
  609.  
  610. End Sub
  611.  
  612.