www.pudn.com > PortTest.rar > port.frm
VERSION 5.00
Begin VB.Form frmMain
Caption = "Port Read/Write Test"
ClientHeight = 3315
ClientLeft = 885
ClientTop = 1530
ClientWidth = 6210
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
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 = 3315
ScaleWidth = 6210
Begin VB.ListBox List1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 840
Left = 240
TabIndex = 5
Top = 960
Width = 4212
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3600
TabIndex = 3
Top = 204
Width = 588
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 1680
TabIndex = 1
Text = "2C"
Top = 192
Width = 612
End
Begin VB.Frame Frame1
Caption = "&Length"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 732
Left = 240
TabIndex = 9
Top = 1920
Width = 4212
Begin VB.OptionButton optDWord
Caption = "&DWORD"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 2280
TabIndex = 13
Top = 360
Width = 1692
End
Begin VB.OptionButton optWord
Caption = "&WORD"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 1200
TabIndex = 11
Top = 360
Width = 972
End
Begin VB.OptionButton optByte
Caption = "&BYTE"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 10
Top = 360
Value = -1 'True
Width = 1092
End
End
Begin VB.CommandButton btnExit
Caption = "E&xit"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4680
TabIndex = 8
Top = 1680
Width = 1212
End
Begin VB.CommandButton btnWrite
Caption = "&Outport"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4680
TabIndex = 7
Top = 960
Width = 1212
End
Begin VB.CommandButton btnRead
Caption = "&Inport"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4680
TabIndex = 6
Top = 240
Width = 1212
End
Begin VB.Label Label4
Caption = "Copyright © 1997-2001 Hai Li, Zeal SoftStudio. haili@public.bta.net.cn"
Height = 495
Left = 120
TabIndex = 12
Top = 2760
Width = 6015
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "&Result:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 192
Left = 240
TabIndex = 4
Top = 600
Width = 492
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "&Output(Hex):"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 192
Left = 2640
TabIndex = 2
Top = 264
Width = 876
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "&Port Address(Hex):"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 192
Left = 240
TabIndex = 0
Top = 240
Width = 1356
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' PortTest sample
' Copyright © 1997-2001 Hai Li, Zeal SoftStudio.
' EMail: haili@public.bta.net.cn
' Web: http://www.zealsoftstudio.com
' This sample illustrates how to use NTPort
' Library to read or write PC I/O ports.
Option Explicit
Private Sub btnExit_Click()
Unload Me
End Sub
Private Sub btnRead_Click()
Dim inNum As Long, portID As Integer
Dim s As String
portID = Val("&H" + Text1.Text)
If optByte.Value Then
inNum = Inport(portID)
ElseIf optWord.Value Then
inNum = InportW(portID)
Else
inNum = InportD(portID)
End If
s = Space(30)
GetLastState s
List1.AddItem "In " & Text1.Text & "H, " & Hex(inNum) + "H"
List1.AddItem s
List1.ListIndex = List1.ListCount - 1
End Sub
Private Sub btnWrite_Click()
Dim outNum As Long, portID As Integer
Dim s As String
portID = Val("&H" + Text1.Text)
outNum = Val("&H" + Text2.Text)
If optByte.Value Then
' Byte
Outport portID, outNum
ElseIf optWord.Value Then
' Word
OutportW portID, outNum
Else
' DWord
OutportD portID, outNum
End If
' Get Error Information
s = Space(30)
GetLastState s
List1.AddItem "Out " & Text1.Text & "H, " & Text2.Text & "H"
List1.AddItem s
List1.ListIndex = List1.ListCount - 1
End Sub
Private Sub Form_Load()
' After register NTPort Library,
' place your registration information here.
LicenseInfo "Your Name", 0
End Sub