📄 serverdlg.frm
字号:
VERSION 5.00
Begin VB.Form ServerDlg
BorderStyle = 3 'Fixed Dialog
Caption = "连接OPC服务器"
ClientHeight = 3000
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6030
Icon = "ServerDlg.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3000
ScaleWidth = 6030
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdFind
Caption = "刷新"
Height = 375
Left = 4680
TabIndex = 5
Top = 1440
Width = 1215
End
Begin VB.ListBox listServer
Height = 1620
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 = "取消"
Height = 375
Left = 4680
TabIndex = 1
Top = 720
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "确定"
Default = -1 'True
Height = 375
Left = 4680
TabIndex = 0
Top = 240
Width = 1215
End
Begin VB.Label Label3
Caption = "服务器列表:"
Height = 255
Left = 120
TabIndex = 8
Top = 960
Width = 1095
End
Begin VB.Label Label2
Caption = "计算机名:"
Height = 255
Left = 120
TabIndex = 7
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "服务器名:"
Height = 255
Left = 120
TabIndex = 6
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
mbVer2 = 2
Dim count As Integer
count = HF_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 = HF_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
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 + -