📄 serverdlg.frm
字号:
VERSION 5.00
Begin VB.Form ServerDlg
BorderStyle = 3 'Fixed Dialog
Caption = "Connect OPC Server"
ClientHeight = 3120
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6030
Icon = "ServerDlg.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3120
ScaleWidth = 6030
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdFind
Caption = "Find"
Height = 375
Left = 4680
TabIndex = 6
Top = 1440
Width = 1215
End
Begin VB.CheckBox ckVer1
Caption = "Using OPC 1.0"
Height = 255
Left = 1200
TabIndex = 5
Top = 2760
Width = 1695
End
Begin VB.ListBox listServer
Height = 1680
Left = 1200
TabIndex = 4
Top = 960
Width = 3255
End
Begin VB.TextBox txtMachineName
Height = 270
Left = 1200
TabIndex = 3
Text = "Text1"
Top = 600
Width = 3255
End
Begin VB.TextBox txtServerName
Height = 270
Left = 1200
TabIndex = 2
Text = "Text1"
Top = 240
Width = 3255
End
Begin VB.CommandButton CancelButton
Caption = "&Cancel"
Height = 375
Left = 4680
TabIndex = 1
Top = 720
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "&OK"
Default = -1 'True
Height = 375
Left = 4680
TabIndex = 0
Top = 240
Width = 1215
End
Begin VB.Label Label3
Caption = "Server List:"
Height = 255
Left = 0
TabIndex = 9
Top = 960
Width = 1215
End
Begin VB.Label Label2
Caption = "Node Name:"
Height = 255
Left = 120
TabIndex = 8
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "Item Name:"
Height = 255
Left = 120
TabIndex = 7
Top = 240
Width = 975
End
End
Attribute VB_Name = "ServerDlg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mstrMachineName As String
Public mstrServerName As String
Public mbVer2 As Long
Public mbReturn As Boolean
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub ckVer1_Click()
cmdFind_Click
End Sub
Private Sub cmdFind_Click()
Dim buf(100) As Byte
listServer.Clear
txtServerName.Text = ""
mstrMachineName = txtMachineName.Text
StringToByte mstrMachineName, buf
If ckVer1.Value = 0 Then
mbVer2 = 1
Else
mbVer2 = 0
End If
Dim count As Integer
count = KOC_GetServerCount(buf(0), mbVer2)
If count = -1 Then
MsgBox "Error getting server list"
Exit Sub
End If
Dim i, j As Integer
Dim bReturn As Boolean
Dim strName As String
For i = 0 To count - 1
bReturn = KOC_GetServerName(i, buf(0), 100)
If bReturn = True Then
strName = ""
For j = 0 To 99
strName = strName + Chr(buf(j))
Next j
listServer.AddItem strName
End If
Next i
End Sub
Private Sub Form_Load()
mbReturn = False
ckVer1.Value = 0
txtMachineName.Text = ""
txtServerName.Text = ""
cmdFind_Click
End Sub
Private Sub listServer_Click()
If listServer.ListIndex = -1 Then Exit Sub
txtServerName.Text = listServer.Text
mstrServerName = txtServerName.Text
End Sub
Private Sub OKButton_Click()
mbReturn = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -