VERSION 5.00 Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX" Begin VB.Form MainForm Caption = "Porter" ClientHeight = 4455 ClientLeft = 60 ClientTop = 345 ClientWidth = 4455 LinkTopic = "Form1" ScaleHeight = 297 ScaleMode = 3 'Pixel ScaleWidth = 297 StartUpPosition = 2 'CenterScreen Begin MSCommLib.MSComm Commo Left = 1800 Top = 2040 _ExtentX = 1005 _ExtentY = 1005 _Version = 393216 DTREnable = -1 'True RThreshold = 1 BaudRate = 14400 ParitySetting = 2 End Begin VB.CommandButton ConnectBut Caption = "Connect" Height = 375 Left = 2760 TabIndex = 7 Tag = "0" Top = 330 Width = 1575 End Begin VB.ComboBox BaudCombo Height = 315 ItemData = "MainForm.frx":0000 Left = 720 List = "MainForm.frx":002B Style = 2 'Dropdown List TabIndex = 4 Top = 360 Width = 1935 End Begin VB.TextBox PortText Alignment = 2 'Center Height = 315 Left = 120 TabIndex = 3 Text = "5" Top = 360 Width = 495 End Begin VB.TextBox LineText Height = 315 Left = 120 TabIndex = 0 Top = 4065 Width = 3495 End Begin VB.TextBox ConvoText BackColor = &H00000000& ForeColor = &H00FFFFFF& Height = 3135 Left = 120 Locked = -1 'True MultiLine = -1 'True TabIndex = 2 Top = 840 Width = 4215 End Begin VB.CommandButton SendBut Caption = "Send" Enabled = 0 'False Height = 375 Left = 3720 TabIndex = 1 ToolTipText = "Send Line" Top = 4035 Width = 615 End Begin VB.Label PortLabel Alignment = 2 'Center BackStyle = 0 'Transparent Caption = "Port" Height = 255 Left = 0 TabIndex = 6 Top = 120 Width = 735 End Begin VB.Label BaudLabel BackStyle = 0 'Transparent Caption = "Baud Rate" Height = 255 Left = 840 TabIndex = 5 Top = 120 Width = 1575 End End Attribute VB_Name = "MainForm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub Commo_OnComm() Static ThisLine As String Dim I As Integer If Commo.CommEvent = comEvReceive Then ThisLine = ThisLine + Commo.Input I = InStr(ThisLine, vbCr) If I > 0 Then PushLine Left$(ThisLine, I - 1) ThisLine = Mid$(ThisLine, I + 1) End If End If End Sub Private Sub PushLine(ByVal Text As String) ConvoText.SelStart = Len(ConvoText.Text) ConvoText.SelText = Text + vbCrLf ConvoText.SelStart = Len(ConvoText.Text) End Sub Private Sub ConnectBut_Click() If ConnectBut.Tag = 0 Then If BaudCombo.ListIndex < 0 Then BaudCombo.ListIndex = 6 Else BaudCombo.Text = BaudCombo.List(BaudCombo.ListIndex) End If Commo.CommPort = Val(PortText.Text) Commo.Settings = BaudCombo.Text + ",e,7,1" Commo.PortOpen = True ConnectBut.Caption = "Disconnect" ConnectBut.Tag = 1 SendBut.Enabled = True Else Commo.PortOpen = False ConnectBut.Caption = "Connect" ConnectBut.Tag = 0 SendBut.Enabled = False End If End Sub Private Sub Form_Load() PortText.Text = 5 BaudCombo.Text = 9600 End Sub Private Sub SendBut_Click() Commo.Output = LineText.Text + vbCr PushLine LineText.Text LineText.SetFocus End Sub