📄 port.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Port Read/Write Test"
ClientHeight = 3576
ClientLeft = 888
ClientTop = 1536
ClientWidth = 6420
BeginProperty Font
Name = "MS Sans Serif"
Size = 7.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Icon = "port.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 3576
ScaleWidth = 6420
Begin VB.Frame Frame2
Caption = "&Carry System"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 732
Left = 360
TabIndex = 9
Top = 2400
Width = 3132
Begin VB.OptionButton optHex
Caption = "&Hex"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 1440
TabIndex = 11
Top = 360
Value = -1 'True
Width = 1572
End
Begin VB.OptionButton optDec
Caption = "&Dec"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 10
Top = 360
Width = 1332
End
End
Begin VB.ListBox List1
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1248
Left = 360
TabIndex = 5
Top = 960
Width = 4212
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3840
TabIndex = 3
Top = 204
Width = 708
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 1200
TabIndex = 1
Top = 192
Width = 612
End
Begin VB.Frame Frame1
Caption = "&Length"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 732
Left = 3720
TabIndex = 12
Top = 2400
Width = 2532
Begin VB.OptionButton optWord
Caption = "&Word"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 1440
TabIndex = 14
Top = 360
Width = 972
End
Begin VB.OptionButton optByte
Caption = "&Byte"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 13
Top = 360
Value = -1 'True
Width = 1092
End
End
Begin VB.CommandButton btnExit
Caption = "E&xit"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5040
TabIndex = 8
Top = 1680
Width = 1212
End
Begin VB.CommandButton btnWrite
Caption = "&Outport"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5040
TabIndex = 7
Top = 960
Width = 1212
End
Begin VB.CommandButton btnRead
Caption = "&Inport"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 5040
TabIndex = 6
Top = 240
Width = 1212
End
Begin VB.Label Label4
Caption = "Copyright(c) 1997 Hai Li, Zeal SoftStudio. haili@public.bta.net.cn"
Height = 252
Left = 360
TabIndex = 15
Top = 3240
Width = 5532
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "&Result:"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 360
TabIndex = 4
Top = 600
Width = 660
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "&Output:"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3000
TabIndex = 2
Top = 264
Width = 708
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "&Port ID:"
BeginProperty Font
Name = "System"
Size = 9.6
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 360
TabIndex = 0
Top = 240
Width = 708
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Vbio32.dll Sample
' Copyright(c) 1997 Hai Li, Zeal SoftStudio
' e-mail: haili@public.bta.net.cn
' http://members.tripod.com/~zealsoft
'
Option Explicit
Private Declare Sub Outport Lib "Vbio32.dll" (ByVal portid%, ByVal nbyte%)
Private Declare Sub OutportW Lib "Vbio32.dll" (ByVal portid%, ByVal nbyte%)
Private Declare Function Inport Lib "Vbio32.dll" (ByVal portid%) As Integer
Private Declare Function InportW Lib "Vbio32.dll" (ByVal portid%) As Integer
Private Sub btnExit_Click()
Unload Me
End Sub
Private Sub btnRead_Click()
Dim innum As Integer, portid As Integer
If optHex.Value Then
portid = Val("&H" + Text1.Text)
Else
portid = Val(Text1.Text)
End If
If optByte.Value Then
innum = Inport(portid)
Else
innum = Inport(portid)
End If
List1.AddItem "In " & Text1.Text & IIf(optHex.Value, "H", "") & ", " & IIf(optHex.Value, Hex(innum) & "H", innum)
List1.ListIndex = List1.ListCount - 1
End Sub
Private Sub btnWrite_Click()
Dim outnum As Integer, portid As Integer
If optHex.Value Then
portid = Val("&H" + Text1.Text)
outnum = Val("&H" + Text2.Text)
Else
portid = Val(Text1.Text)
outnum = Val(Text2.Text)
End If
If optByte.Value Then
Outport portid, outnum
Else
OutportW portid, outnum
End If
List1.AddItem "Out " & Text1.Text & IIf(optHex.Value, "H", "") & ", " & Text2.Text & IIf(optHex.Value, "H", "")
List1.ListIndex = List1.ListCount - 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -