home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / comdem / eventdlg.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  10.9 KB  |  324 lines

  1. VERSION 2.00
  2. Begin Form EventDlg 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Communication Demo - Event Settings"
  5.    ClientHeight    =   4425
  6.    ClientLeft      =   1215
  7.    ClientTop       =   1755
  8.    ClientWidth     =   6150
  9.    Height          =   4830
  10.    Icon            =   0
  11.    Left            =   1155
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form7"
  14.    ScaleHeight     =   4425
  15.    ScaleWidth      =   6150
  16.    Top             =   1410
  17.    Width           =   6270
  18.    Begin CommandButton Cancel_Command 
  19.       Caption         =   "Cancel"
  20.       Height          =   375
  21.       Left            =   4200
  22.       TabIndex        =   20
  23.       Top             =   3840
  24.       Width           =   1815
  25.    End
  26.    Begin CommandButton OK_Command 
  27.       Caption         =   "OK"
  28.       Height          =   375
  29.       Left            =   2160
  30.       TabIndex        =   19
  31.       Top             =   3840
  32.       Width           =   1815
  33.    End
  34.    Begin CommandButton Reset_Command 
  35.       Caption         =   "Reset"
  36.       Height          =   375
  37.       Left            =   120
  38.       TabIndex        =   18
  39.       Top             =   3840
  40.       Width           =   1815
  41.    End
  42.    Begin Frame Error_Status_Frame 
  43.       Height          =   1455
  44.       Left            =   2880
  45.       TabIndex        =   14
  46.       Top             =   2160
  47.       Width           =   3135
  48.       Begin CheckBox Printer_Error_Check 
  49.          Caption         =   "Printer Error"
  50.          Height          =   255
  51.          Left            =   120
  52.          TabIndex        =   17
  53.          Top             =   960
  54.          Width           =   2895
  55.       End
  56.       Begin CheckBox Line_Status_Error_Check 
  57.          Caption         =   "Line Status Error"
  58.          Height          =   255
  59.          Left            =   120
  60.          TabIndex        =   16
  61.          Top             =   480
  62.          Width           =   2895
  63.       End
  64.       Begin Label Error_Status_Label 
  65.          Alignment       =   2  'Center
  66.          BorderStyle     =   1  'Fixed Single
  67.          Caption         =   "Error Status"
  68.          Height          =   255
  69.          Left            =   0
  70.          TabIndex        =   15
  71.          Top             =   90
  72.          Width           =   3135
  73.       End
  74.    End
  75.    Begin Frame Status_Detected_Frame 
  76.       Height          =   1455
  77.       Left            =   120
  78.       TabIndex        =   10
  79.       Top             =   2160
  80.       Width           =   2655
  81.       Begin CheckBox Ring_Indicator_Check 
  82.          Caption         =   "Ring Indicator Detected"
  83.          Height          =   255
  84.          Left            =   120
  85.          TabIndex        =   13
  86.          Top             =   960
  87.          Width           =   2385
  88.       End
  89.       Begin CheckBox Break_Detected_Check 
  90.          Caption         =   "Break Detected"
  91.          Height          =   255
  92.          Left            =   120
  93.          TabIndex        =   12
  94.          Top             =   480
  95.          Width           =   2385
  96.       End
  97.       Begin Label Status_Detected_Label 
  98.          Alignment       =   2  'Center
  99.          BorderStyle     =   1  'Fixed Single
  100.          Caption         =   "Status Detected"
  101.          Height          =   255
  102.          Left            =   0
  103.          TabIndex        =   11
  104.          Top             =   90
  105.          Width           =   2655
  106.       End
  107.    End
  108.    Begin Frame Events_Received_Frame 
  109.       Height          =   1935
  110.       Left            =   2880
  111.       TabIndex        =   5
  112.       Top             =   120
  113.       Width           =   3135
  114.       Begin CheckBox Last_Character_Sent_Check 
  115.          Caption         =   "Last Character Sent"
  116.          Height          =   255
  117.          Left            =   120
  118.          TabIndex        =   9
  119.          Top             =   1440
  120.          Width           =   2895
  121.       End
  122.       Begin CheckBox Event_Character_Received_Check 
  123.          Caption         =   "Event Character Received"
  124.          Height          =   255
  125.          Left            =   120
  126.          TabIndex        =   8
  127.          Top             =   960
  128.          Width           =   2895
  129.       End
  130.       Begin CheckBox Characters_Received_Check 
  131.          Caption         =   "Character Received in Queue"
  132.          Enabled         =   0   'False
  133.          Height          =   255
  134.          Left            =   120
  135.          TabIndex        =   7
  136.          Top             =   480
  137.          Value           =   2  'Grayed
  138.          Width           =   2895
  139.       End
  140.       Begin Label Events_Received_Label 
  141.          Alignment       =   2  'Center
  142.          BorderStyle     =   1  'Fixed Single
  143.          Caption         =   "Events Received"
  144.          Height          =   255
  145.          Left            =   0
  146.          TabIndex        =   6
  147.          Top             =   90
  148.          Width           =   3135
  149.       End
  150.    End
  151.    Begin Frame Signal_Changes_Frame 
  152.       Height          =   1935
  153.       Left            =   120
  154.       TabIndex        =   0
  155.       Top             =   120
  156.       Width           =   2655
  157.       Begin CheckBox Receive_Line_Detect_Check 
  158.          Caption         =   "Receive Line Detect"
  159.          Height          =   255
  160.          Left            =   120
  161.          TabIndex        =   4
  162.          Top             =   1440
  163.          Width           =   2385
  164.       End
  165.       Begin CheckBox Data_Set_Ready_Check 
  166.          Caption         =   "Data Set Ready"
  167.          Height          =   255
  168.          Left            =   120
  169.          TabIndex        =   3
  170.          Top             =   960
  171.          Width           =   2385
  172.       End
  173.       Begin CheckBox Clear_To_Send_Check 
  174.          Caption         =   "Clear To Send"
  175.          Height          =   255
  176.          Left            =   120
  177.          TabIndex        =   2
  178.          Top             =   480
  179.          Width           =   2385
  180.       End
  181.       Begin Label Signal_Changes_Label 
  182.          Alignment       =   2  'Center
  183.          BorderStyle     =   1  'Fixed Single
  184.          Caption         =   "Signal Changes"
  185.          Height          =   255
  186.          Left            =   0
  187.          TabIndex        =   1
  188.          Top             =   90
  189.          Width           =   2655
  190.       End
  191.    End
  192. Dim WorkEventMask As Integer
  193. Sub Break_Detected_Check_Click ()
  194.     If Break_Detected_Check.Value Then
  195.         WorkEventMask = WorkEventMask Or EV_BREAK
  196.     Else
  197.         WorkEventMask = WorkEventMask And (EV_ALL - EV_BREAK)
  198.     End If
  199. End Sub
  200. Sub Cancel_Command_Click ()
  201.     Unload EventDlg
  202. End Sub
  203. Sub Characters_Received_Check_Click ()
  204.     If Characters_Received_Check.Value Then
  205.         WorkEventMask = WorkEventMask Or EV_RXCHAR
  206.     Else
  207.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RXCHAR)
  208.     End If
  209. End Sub
  210. Sub Clear_To_Send_Check_Click ()
  211.     If Clear_To_Send_Check.Value Then
  212.         WorkEventMask = WorkEventMask Or EV_CTS
  213.     Else
  214.         WorkEventMask = WorkEventMask And (EV_ALL - EV_CTS)
  215.     End If
  216. End Sub
  217. Sub Data_Set_Ready_Check_Click ()
  218.     If Data_Set_Ready_Check.Value Then
  219.         WorkEventMask = WorkEventMask Or EV_DSR
  220.     Else
  221.         WorkEventMask = WorkEventMask And (EV_ALL - EV_DSR)
  222.     End If
  223. End Sub
  224. Sub Event_Character_Received_Check_Click ()
  225.     If Event_Character_Received_Check.Value Then
  226.         WorkEventMask = WorkEventMask Or EV_RXFLAG
  227.     Else
  228.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RXFLAG)
  229.     End If
  230. End Sub
  231. Sub Form_Load ()
  232.     Remove_Items_From_SysMenu EventDlg
  233.     Initialize
  234.     CenterDialog EventDlg
  235. End Sub
  236. Sub Form_Paint ()
  237.     UpdateCaption " DIALOG: " + caption, 0
  238. End Sub
  239. Sub Initialize ()
  240.     WorkEventMask = CommEventMask
  241.     Clear_To_Send_Check.Value = Abs((WorkEventMask And EV_CTS) = EV_CTS)
  242.     Data_Set_Ready_Check.Value = Abs((WorkEventMask And EV_DSR) = EV_DSR)
  243.     Receive_Line_Detect_Check.Value = Abs((WorkEventMask And EV_RLSD) = EV_RLSD)
  244.     Characters_Received_Check.Value = Abs((WorkEventMask And EV_RXCHAR) = EV_RXCHAR)
  245.     Event_Character_Received_Check.Value = Abs((WorkEventMask And EV_RXFLAG) = EV_RXFLAG)
  246.     Last_Character_Sent_Check.Value = Abs((WorkEventMask And EV_TXEMPTY) = EV_TXEMPTY)
  247.     Break_Detected_Check.Value = Abs((WorkEventMask And EV_BREAK) = EV_BREAK)
  248.     Ring_Indicator_Check.Value = Abs((WorkEventMask And EV_RING) = EV_RING)
  249.     Line_Status_Error_Check.Value = Abs((WorkEventMask And EV_ERR) = EV_ERR)
  250.     Printer_Error_Check.Value = Abs((WorkEventMask And EV_PERR) = EV_PERR)
  251. End Sub
  252. Sub Last_Character_Sent_Check_Click ()
  253.     If Last_Character_Sent_Check.Value Then
  254.         WorkEventMask = WorkEventMask Or EV_TXEMPTY
  255.     Else
  256.         WorkEventMask = WorkEventMask And (EV_ALL - EV_TXEMPTY)
  257.     End If
  258. End Sub
  259. Sub Line_Status_Error_Check_Click ()
  260.     If Line_Status_Error_Check.Value Then
  261.         WorkEventMask = WorkEventMask Or EV_ERR
  262.     Else
  263.         WorkEventMask = WorkEventMask And (EV_ALL - EV_ERR)
  264.     End If
  265. End Sub
  266. Sub OK_Command_Click ()
  267.     If CommDeviceNum > 0 And CommHandle > -1 Then
  268.         If WorkEventMask = CommEventMask Then
  269.             Unload EventDlg
  270.             Exit Sub
  271.         End If
  272.         UpdateCaption " DIALOG: Change Active Settings (Yes), Post-Pone (No), Return to Dialog (Cancel)", 0
  273.         
  274.         Result% = MsgBox("Port Already Active!" + Chr$(13) + "Activate settings Now?", 3 + 16 + 256, "Terminal Sampler II - Port Active")
  275.         Select Case Result%
  276.             Case 6
  277.                 UpdateCaption " Changing Port Settings LIVE!", 0
  278.                 
  279.                 CommEventMask = WorkEventMask
  280.                 PostEventMask = WorkEventMask
  281.                 ApiErr% = SetCommEventMask(CommHandle, CommEventMask)
  282.                 
  283.                 Unload EventDlg
  284.             Case 7
  285.                 UpdateCaption " Settings Post-Poned until next CONNECT", 0
  286.                 
  287.                 PostEventMask = WorkEventMask
  288.                 
  289.                 Unload EventDlg
  290.             Case Else
  291.                 UpdateCaption " DIALOG: " + caption, 0
  292.         End Select
  293.     Else
  294.         
  295.         CommEventMask = WorkEventMask
  296.         PostEventMask = WorkEventMask
  297.         Unload EventDlg
  298.     End If
  299. End Sub
  300. Sub Printer_Error_Check_Click ()
  301.     If Printer_Error_Check.Value Then
  302.         WorkEventMask = WorkEventMask Or EV_PERR
  303.     Else
  304.         WorkEventMask = WorkEventMask And (EV_ALL - EV_PERR)
  305.     End If
  306. End Sub
  307. Sub Receive_Line_Detect_Check_Click ()
  308.     If Receive_Line_Detect_Check.Value Then
  309.         WorkEventMask = WorkEventMask Or EV_RLSD
  310.     Else
  311.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RLSD)
  312.     End If
  313. End Sub
  314. Sub Reset_Command_Click ()
  315.     Initialize
  316. End Sub
  317. Sub Ring_Indicator_Check_Click ()
  318.     If Ring_Indicator_Check.Value Then
  319.         WorkEventMask = WorkEventMask Or EV_RING
  320.     Else
  321.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RING)
  322.     End If
  323. End Sub
  324.