📄 commdemo.frm
字号:
VERSION 4.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"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 5595
Left = 915
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 8400
Top = 1155
Width = 8520
Begin VB.Timer Timer1
Interval = 100
Left = 240
Top = 60
End
Begin VB.TextBox TermText
Appearance = 0 'Flat
BeginProperty Font
name = "Fixedsys"
charset = 0
weight = 400
size = 9
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
End
Attribute VB_Name = "CommDemo"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
'
' 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -