?? form1.frm
字號:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2520
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 2520
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
CausesValidation= 0 'False
Height = 330
ItemData = "Form1.frx":0000
Left = 2880
List = "Form1.frx":000A
TabIndex = 5
Text = "顯示"
Top = 240
Width = 1215
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
MaxLength = 9
TabIndex = 0
Text = "012345671"
Top = 1560
Width = 2100
End
Begin VB.CommandButton Command2
Caption = "二號屏發送"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 3
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "一號屏發送"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 2
Top = 840
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
MaxLength = 9
TabIndex = 1
Text = "012345671"
Top = 720
Width = 2055
End
Begin MSCommLib.MSComm MSComm1
Left = 120
Top = 120
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin VB.Label Label1
Caption = "屏幕顯示狀態:"
BeginProperty Font
Name = "MS Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 960
TabIndex = 4
Top = 240
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim commandreceive As String
Dim commandsend As String
Dim commandreset As String
Dim strdispid As String
Dim strdatasend As String
Dim strreceive As String
Private Sub Command1_Click()
MSComm1.InBufferCount = 0 '清除發送緩沖區數據
MSComm1.OutBufferCount = 0 '清除接收緩沖區數據
If Combo1.Text = "顯示" Then
commandreset = "1"
Else
commandreset = "0"
End If
'commandreceive = "55" ' 55H: 要求大屏幕接收數據
'commandreset = "ff" 'FFH 大屏幕復位,重新接收地址
strdispid = "e01" '兩位地址位
strdadasend = Text1.Text
'strdispid = Left(strdadasend, 2) '取兩位地址位
'MSComm1.Output = commandreset '大屏幕復位,重新接收地址
'MSComm1.Output = commandreceive '要求大屏幕接收數據
MSComm1.Output = strdispid '向COM1發送地址
MSComm1.Output = strdadasend '如果相同則發送數據
MSComm1.Output = commandreset '大屏幕復位,重新接收地址
End Sub
Private Sub Command2_Click()
MSComm1.InBufferCount = 0 '清除發送緩沖區數據
MSComm1.OutBufferCount = 0 '清除接收緩沖區數據
If Combo1.Text = "顯示" Then
commandreset = "1"
Else
commandreset = "0"
End If
'commandreceive = "55" ' 55H: 要求大屏幕接收數據
'commandreset = "ff" 'FFH 大屏幕復位,重新接收地址
strdispid = "e02" '兩位地址位
strdadasend = Text2.Text
'strdispid = Left(strdadasend, 2) '取兩位地址位
'MSComm1.Output = commandreceive '要求大屏幕接收數據
MSComm1.Output = strdispid '向COM1發送地址
MSComm1.Output = strdadasend '如果相同則發送數據
MSComm1.Output = commandreset '大屏幕復位,重新接收地址
End Sub
Private Sub Form_Load()
MSComm1.InBufferCount = 0 '清除發送緩沖區數據
MSComm1.OutBufferCount = 0 '清除接收緩沖區數據
commandsend = "aa" 'AAH: 要求大屏幕發送數據
commandreset = "1"
MSComm1.CommPort = 1 ' 選擇COM口1
MSComm1.Settings = "9600,N,8,1" '波特率為9600,無奇偶校驗,8位數據位,一位停止位
MSComm1.PortOpen = True ' 打開串行口
MSComm1.InputLen = 0 '讀取整個接收緩沖區內碼或消除
'MSComm1.Output = commandreset '大屏幕復位,重新接收地址
'MSComm1.Output = commandreceive '要求大屏幕接收數據
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive
strreceive = MSComm1.Input '從COM接收地址
'Text2.Text = strreceive '顯示接收的數據
If strdispid = strreceive Then
MSComm1.Output = strdadasend '如果相同則發送數據
Else: MSComm1.Output = commandreset '不相同則復位
End If
End Select
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -