home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form CommDemo
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Communications Demo - Mini Terminal"
- ClientHeight = 4905
- ClientLeft = 975
- ClientTop = 1785
- ClientWidth = 8400
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 4905
- ScaleWidth = 8400
- Begin VB.Timer Timer1
- Interval = 100
- Left = 240
- Top = 60
- End
- Begin VB.TextBox TermText
- Appearance = 0 'Flat
- BeginProperty Font
- Name = "Fixedsys"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 4095
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 3 'Both
- TabIndex = 0
- Top = 600
- Width = 8175
- End
- Begin VB.PictureBox Callback1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- ForeColor = &H80000008&
- Height = 480
- Left = 7800
- ScaleHeight = 450
- ScaleWidth = 1170
- TabIndex = 1
- Top = 120
- Width = 1200
- End
- Begin VB.Menu MenuConfigure
- Caption = "Configure"
- End
- Begin VB.Menu MenuDial
- Caption = "Dial"
- End
- Attribute VB_Name = "CommDemo"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- ' Copyright
- 1997 by Desaware Inc. All Rights Reserved
- ' We open the port and get things started here
- Private Sub Form_Load()
- ' We load the configuration form so that the default
- ' settings can be read by OpenThePort
- Commcfg.Show 1
- TermText.Move 0, 0, ScaleWidth, ScaleHeight
- End Sub
- Private Sub Form_Resize()
- TermText.Move 0, 0, ScaleWidth, ScaleHeight
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Set Comm = Nothing
- End Sub
- Private Sub MenuConfigure_Click()
- Commcfg.Show 1
- End Sub
- Private Sub MenuDial_Click()
- Dim dnum$
- If Not (Comm Is Nothing) Then
- TermText.Text = ""
- dnum$ = InputBox$("Enter number to dial", "Dialer")
- Comm.CommOutput "ATTD" + dnum$ + Chr$(13)
- End If
- End Sub
- Private Sub TermText_KeyPress(KeyAscii As Integer)
- If Not (Comm Is Nothing) Then
- Comm.CommOutput (Chr$(KeyAscii))
- End If
- KeyAscii = 0
- End Sub
- Public Sub CommInput(thiscomm As dwComm, commdata As String)
- Dim use$
- Dim cpos%
- If commdata <> "" Then
- ' Substitute the CR with a CRLF pair, dump the LF
-
- For cpos% = 1 To Len(commdata$)
- Select Case Asc(Mid$(commdata$, cpos%))
- Case 13
- use$ = use$ + Chr$(13) + Chr$(10)
- Case 10
- ' Dump the line feeds
- Case Else
- use$ = use$ + Mid$(commdata$, cpos%, 1)
- End Select
- Next cpos%
- TermText.SelStart = Len(TermText.Text)
- TermText.SelLength = 0
- TermText.SelText = use$
-
- If Len(TermText.Text) > 4096 Then
- TermText.Text = Right$(TermText.Text, 2048)
- End If
- TermText.SelStart = Len(TermText.Text)
-
- End If
- End Sub
- Public Sub CommEvent(thiscomm As dwComm, ev As String)
- TermText.SelStart = Len(TermText.Text)
- TermText.SelText = vbCrLf & ev & vbCrLf
- TermText.SelStart = Len(TermText.Text)
- End Sub
- Private Sub Timer1_Timer()
- If Not (Comm Is Nothing) Then Comm.Poll
- End Sub
-