📄 frmcomm.frm
字号:
VERSION 5.00
Begin VB.Form frmComm
BorderStyle = 1 'Fixed Single
Caption = "串口设置"
ClientHeight = 2895
ClientLeft = 45
ClientTop = 330
ClientWidth = 4770
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2895
ScaleWidth = 4770
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton Cmd_Cancel
Caption = "退出"
Height = 495
Left = 1440
TabIndex = 13
Top = 2160
Width = 1215
End
Begin VB.CommandButton Cmd_Accept
Caption = "确认"
Height = 495
Left = 120
TabIndex = 12
Top = 2160
Width = 1215
End
Begin VB.Frame Frame2
Caption = "串口"
Height = 2415
Left = 3120
TabIndex = 7
Top = 120
Width = 1335
Begin VB.OptionButton Op_Com
Caption = "COM4"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 240
TabIndex = 11
Top = 1800
Width = 855
End
Begin VB.OptionButton Op_Com
Caption = "COM3"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 240
TabIndex = 10
Top = 1320
Width = 975
End
Begin VB.OptionButton Op_Com
Caption = "COM2"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 240
TabIndex = 9
Top = 840
Width = 975
End
Begin VB.OptionButton Op_Com
Caption = "COM1"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 240
TabIndex = 8
Top = 360
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "波特率"
Height = 1815
Left = 120
TabIndex = 0
Top = 120
Width = 2775
Begin VB.OptionButton Op_Bound
Caption = "115200"
Height = 375
Index = 5
Left = 1560
TabIndex = 6
Top = 1320
Width = 1095
End
Begin VB.OptionButton Op_Bound
Caption = "57600"
Height = 375
Index = 4
Left = 240
TabIndex = 5
Top = 1320
Width = 1095
End
Begin VB.OptionButton Op_Bound
Caption = "38400"
Height = 375
Index = 3
Left = 1560
TabIndex = 4
Top = 840
Width = 855
End
Begin VB.OptionButton Op_Bound
Caption = "19200"
Height = 375
Index = 2
Left = 240
TabIndex = 3
Top = 840
Width = 855
End
Begin VB.OptionButton Op_Bound
Caption = " 9600"
Height = 375
Index = 1
Left = 1560
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.OptionButton Op_Bound
Caption = " 4800"
Height = 375
Index = 0
Left = 240
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "frmComm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public m_strProfile As String
Private Sub Cmd_Accept_Click()
Dim Profile As String
Dim strPort As String
Dim strBound As String
On Error GoTo msgerror
If (Profile = "") Then
Profile = App.Path + "\MakeBarCode.ini"
Else
Profile = m_strProfile
End If
strBound = "9600"
If Op_Bound(0) Then strBound = "4800"
If Op_Bound(2) Then strBound = "19200"
If Op_Bound(3) Then strBound = "38400"
If Op_Bound(4) Then strBound = "57600"
If Op_Bound(5) Then strBound = "115200"
strPort = "COM1"
If Op_Com(1) Then strPort = "COM2"
If Op_Com(2) Then strPort = "COM3"
If Op_Com(3) Then strPort = "COM4"
'提取pdf码的参数
Call WritePrivateProfileString("SCAN", "Baudrate", strBound, Profile)
Call WritePrivateProfileString("SCAN", "Port", strPort, Profile)
Unload Me
Exit Sub
msgerror:
MsgBox Err.Description
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim Profile As String
Dim strPort As String
Dim nBound As Long
On Error GoTo msgerror
If (Profile = "") Then
Profile = App.Path + "\MakeBarCode.ini"
Else
Profile = m_strProfile
End If
'提取pdf码的参数
nBound = 0
strPort = "COM1"
nBound = GetPrivateProfileInt("SCAN", "Baudrate", 0, Profile)
Call GetPrivateProfileString("SCAN", "Port", "COM1", strPort, 5, Profile)
Op_Bound(1).Value = True
If nBound = 4800 Then Op_Bound(0).Value = True
If nBound = 19200 Then Op_Bound(2).Value = True
If nBound = 38400 Then Op_Bound(3).Value = True
If nBound = 57600 Then Op_Bound(4).Value = True
If nBound = 115200 Then Op_Bound(5).Value = True
Op_Com(0).Value = True
If strPort = "COM2" Then Op_Com(1).Value = True
If strPort = "COM3" Then Op_Com(2).Value = True
If strPort = "COM4" Then Op_Com(3).Value = True
Exit Sub
msgerror:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -