home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
bp_3_94
/
vbwin
/
comm
/
vbcomm2.frm
< prev
next >
Wrap
Text File
|
1994-05-03
|
2KB
|
83 lines
VERSION 2.00
Begin Form Form1
BackColor = &H00C0C0C0&
Caption = "BP 3/94 ** Comm-Tester 2 (mit Do...Loop) **"
ClientHeight = 4110
ClientLeft = 930
ClientTop = 1500
ClientWidth = 6945
Height = 4515
Left = 870
LinkTopic = "Form1"
ScaleHeight = 4110
ScaleWidth = 6945
Top = 1155
Width = 7065
Begin TextBox Text1
Height = 3570
Left = 105
MultiLine = -1 'True
ScrollBars = 3 'Beide
TabIndex = 0
Top = 105
Width = 6705
End
Begin MSComm Comm1
Interval = 55
Left = 6375
RTSEnable = -1 'True
Top = 3540
End
Begin Label lblStatus
BackColor = &H00C0C0C0&
BorderStyle = 1 'nicht Σnderbar, einfach
Height = 360
Left = 90
TabIndex = 1
Top = 3735
Width = 6810
End
End
DefInt A-Z
Sub Form_Load ()
Comm1.CommPort = 2 'COM2 verwenden (VOR dem ╓ffnen angeben!)
Comm1.Settings = "1200,N,8,1" '1200 Baud, keine ParitΣt, 8 Datenbits, 1 Stopbit
Comm1.InputLen = 1 'Mit Input je 1 Zeichen lesen
Comm1.OutBufferSize = 512 'Sendepuffer
Comm1.InBufferSize = 1024 'Empfangspuffer
Comm1.PortOpen = True 'COM-Port ÷ffnen
Form1.Show
Do
DoEvents
If Comm1.InBufferCount > 0 Then
Form1.Caption = "Im Empfangspuffer: " + Str$(Comm1.InBufferCount)
Ein$ = Comm1.Input
Select Case Asc(Ein$)
Case 26 'hier kann auch Dateiende (EOF) abgefragt werden
Comm1.PortOpen = False
MsgBox "Dateiende", 16, "▄bertragung"
End
Case 13 'CR
Ein$ = Ein$ + Chr$(10)
Text1.Text = Text1.Text + Ein$
Case Else
Text1.Text = Text1.Text + Ein$
End Select
Text1.SelStart = Len(Text1.Text)
Text1.SelText = ""
End If
Loop
End Sub
Sub Form_Unload (Cancel As Integer)
Comm1.PortOpen = False 'COM-Port schlie▀en
End Sub
Sub Text1_KeyPress (KeyAnsi As Integer)
Comm1.Output = Chr$(KeyAnsi)
End Sub