home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / commdemo / eventdlg.txt < prev    next >
Text File  |  1991-07-11  |  5KB  |  198 lines

  1.  
  2. Dim WorkEventMask As Integer
  3.  
  4. Sub Form_Load ()
  5.  
  6.     Remove_Items_From_SysMenu EventDlg
  7.  
  8.     Initialize
  9.  
  10.     CenterDialog EventDlg
  11.  
  12. End Sub
  13.  
  14.  
  15. Sub Initialize ()
  16.  
  17.     WorkEventMask = CommEventMask
  18.  
  19.     Clear_To_Send_Check.Value = Abs((WorkEventMask And EV_CTS) = EV_CTS)
  20.     Data_Set_Ready_Check.Value = Abs((WorkEventMask And EV_DSR) = EV_DSR)
  21.     Receive_Line_Detect_Check.Value = Abs((WorkEventMask And EV_RLSD) = EV_RLSD)
  22.  
  23.     Characters_Received_Check.Value = Abs((WorkEventMask And EV_RXCHAR) = EV_RXCHAR)
  24.     Event_Character_Received_Check.Value = Abs((WorkEventMask And EV_RXFLAG) = EV_RXFLAG)
  25.     Last_Character_Sent_Check.Value = Abs((WorkEventMask And EV_TXEMPTY) = EV_TXEMPTY)
  26.  
  27.     Break_Detected_Check.Value = Abs((WorkEventMask And EV_BREAK) = EV_BREAK)
  28.     Ring_Indicator_Check.Value = Abs((WorkEventMask And EV_RING) = EV_RING)
  29.  
  30.     Line_Status_Error_Check.Value = Abs((WorkEventMask And EV_ERR) = EV_ERR)
  31.     Printer_Error_Check.Value = Abs((WorkEventMask And EV_PERR) = EV_PERR)
  32.    
  33. End Sub
  34.  
  35. Sub Reset_Command_Click ()
  36.  
  37.     Initialize
  38.  
  39. End Sub
  40.  
  41. Sub OK_Command_Click ()
  42.     
  43.     If CommDeviceNum > 0 And CommHandle > -1 Then
  44.  
  45.         If WorkEventMask = CommEventMask Then
  46.             Unload EventDlg
  47.             Exit Sub
  48.         End If
  49.  
  50.         UpdateCaption " DIALOG: Change Active Settings (Yes), Post-Pone (No), Return to Dialog (Cancel)", 0
  51.         
  52.         Result% = MsgBox("Port Already Active!" + Chr$(13) + "Activate settings Now?", 3 + 16 + 256, "Terminal Sampler II - Port Active")
  53.     
  54.         Select Case Result%
  55.             Case 6
  56.                 UpdateCaption " Changing Port Settings LIVE!", 0
  57.                 
  58.                 CommEventMask = WorkEventMask
  59.                 PostEventMask = WorkEventMask
  60.  
  61.                 ApiErr% = SetCommEventMask(CommHandle, CommEventMask)
  62.                 
  63.                 Unload EventDlg
  64.             Case 7
  65.                 UpdateCaption " Settings Post-Poned until next CONNECT", 0
  66.                 
  67.                 PostEventMask = WorkEventMask
  68.                 
  69.                 Unload EventDlg
  70.             Case Else
  71.                 UpdateCaption " DIALOG: " + caption, 0
  72.         End Select
  73.  
  74.     Else
  75.         
  76.         CommEventMask = WorkEventMask
  77.         PostEventMask = WorkEventMask
  78.  
  79.         Unload EventDlg
  80.  
  81.     End If
  82.  
  83. End Sub
  84.  
  85. Sub Cancel_Command_Click ()
  86.  
  87.     Unload EventDlg
  88.  
  89. End Sub
  90.  
  91. Sub Break_Detected_Check_Click ()
  92.     
  93.     If Break_Detected_Check.Value Then
  94.         WorkEventMask = WorkEventMask Or EV_BREAK
  95.     Else
  96.         WorkEventMask = WorkEventMask And (EV_ALL - EV_BREAK)
  97.     End If
  98.  
  99. End Sub
  100.  
  101. Sub Characters_Received_Check_Click ()
  102.  
  103.     If Characters_Received_Check.Value Then
  104.         WorkEventMask = WorkEventMask Or EV_RXCHAR
  105.     Else
  106.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RXCHAR)
  107.     End If
  108.  
  109.  
  110. End Sub
  111.  
  112. Sub Clear_To_Send_Check_Click ()
  113.  
  114.     If Clear_To_Send_Check.Value Then
  115.         WorkEventMask = WorkEventMask Or EV_CTS
  116.     Else
  117.         WorkEventMask = WorkEventMask And (EV_ALL - EV_CTS)
  118.     End If
  119.  
  120. End Sub
  121.  
  122. Sub Data_Set_Ready_Check_Click ()
  123.  
  124.     If Data_Set_Ready_Check.Value Then
  125.         WorkEventMask = WorkEventMask Or EV_DSR
  126.     Else
  127.         WorkEventMask = WorkEventMask And (EV_ALL - EV_DSR)
  128.     End If
  129.  
  130. End Sub
  131.  
  132. Sub Event_Character_Received_Check_Click ()
  133.  
  134.     If Event_Character_Received_Check.Value Then
  135.         WorkEventMask = WorkEventMask Or EV_RXFLAG
  136.     Else
  137.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RXFLAG)
  138.     End If
  139.  
  140. End Sub
  141.  
  142. Sub Last_Character_Sent_Check_Click ()
  143.  
  144.     If Last_Character_Sent_Check.Value Then
  145.         WorkEventMask = WorkEventMask Or EV_TXEMPTY
  146.     Else
  147.         WorkEventMask = WorkEventMask And (EV_ALL - EV_TXEMPTY)
  148.     End If
  149.  
  150. End Sub
  151.  
  152. Sub Line_Status_Error_Check_Click ()
  153.  
  154.     If Line_Status_Error_Check.Value Then
  155.         WorkEventMask = WorkEventMask Or EV_ERR
  156.     Else
  157.         WorkEventMask = WorkEventMask And (EV_ALL - EV_ERR)
  158.     End If
  159.  
  160. End Sub
  161.  
  162. Sub Printer_Error_Check_Click ()
  163.  
  164.     If Printer_Error_Check.Value Then
  165.         WorkEventMask = WorkEventMask Or EV_PERR
  166.     Else
  167.         WorkEventMask = WorkEventMask And (EV_ALL - EV_PERR)
  168.     End If
  169.  
  170. End Sub
  171.  
  172. Sub Receive_Line_Detect_Check_Click ()
  173.  
  174.     If Receive_Line_Detect_Check.Value Then
  175.         WorkEventMask = WorkEventMask Or EV_RLSD
  176.     Else
  177.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RLSD)
  178.     End If
  179.  
  180. End Sub
  181.  
  182. Sub Ring_Indicator_Check_Click ()
  183.  
  184.     If Ring_Indicator_Check.Value Then
  185.         WorkEventMask = WorkEventMask Or EV_RING
  186.     Else
  187.         WorkEventMask = WorkEventMask And (EV_ALL - EV_RING)
  188.     End If
  189.  
  190. End Sub
  191.  
  192. Sub Form_Paint ()
  193.  
  194.     UpdateCaption " DIALOG: " + caption, 0
  195.  
  196. End Sub
  197.  
  198.