?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "OPCClient "
ClientHeight = 7455
ClientLeft = 60
ClientTop = 435
ClientWidth = 10365
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7455
ScaleWidth = 10365
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdAdvise
Caption = "Advise"
Height = 435
Left = 4860
TabIndex = 36
Top = 6480
Width = 1635
End
Begin VB.CommandButton cmdAsyncWrite
Caption = "Async Write"
Height = 435
Left = 2700
TabIndex = 35
Top = 6480
Width = 1635
End
Begin VB.CommandButton cmdAsyncRead
Caption = "Async Read"
Height = 435
Left = 540
TabIndex = 34
Top = 6480
Width = 1635
End
Begin VB.TextBox txtStatus
Enabled = 0 'False
Height = 435
Left = 60
TabIndex = 30
Top = 7020
Width = 10335
End
Begin VB.Frame Frame2
Caption = "OPC Group"
Height = 4635
Left = 540
TabIndex = 5
Top = 1680
Width = 8775
Begin VB.TextBox txtUpdate
Height = 375
Left = 2160
TabIndex = 32
Top = 3960
Width = 1335
End
Begin VB.CommandButton cmdAddItems
Caption = "AddItem"
Height = 375
Left = 480
TabIndex = 31
Top = 3480
Width = 1395
End
Begin VB.TextBox TxtQuality
Height = 375
Index = 4
Left = 6420
TabIndex = 29
Top = 2940
Width = 1395
End
Begin VB.TextBox TxtValue
Height = 375
Index = 4
Left = 4620
TabIndex = 28
Top = 2940
Width = 1395
End
Begin VB.TextBox TxtItem
Height = 375
Index = 4
Left = 2160
TabIndex = 27
Top = 2940
Width = 1395
End
Begin VB.TextBox TxtTopic
Height = 375
Index = 4
Left = 480
TabIndex = 26
Top = 2940
Width = 1395
End
Begin VB.TextBox TxtQuality
Height = 375
Index = 3
Left = 6420
TabIndex = 25
Top = 2400
Width = 1395
End
Begin VB.TextBox TxtValue
Height = 375
Index = 3
Left = 4620
TabIndex = 24
Top = 2400
Width = 1395
End
Begin VB.TextBox TxtItem
Height = 375
Index = 3
Left = 2160
TabIndex = 23
Top = 2400
Width = 1395
End
Begin VB.TextBox TxtTopic
Height = 375
Index = 3
Left = 480
TabIndex = 22
Top = 2400
Width = 1395
End
Begin VB.TextBox TxtQuality
Height = 375
Index = 2
Left = 6420
TabIndex = 21
Top = 1800
Width = 1395
End
Begin VB.TextBox TxtValue
Height = 375
Index = 2
Left = 4620
TabIndex = 20
Top = 1800
Width = 1395
End
Begin VB.TextBox TxtItem
Height = 375
Index = 2
Left = 2160
TabIndex = 19
Top = 1800
Width = 1395
End
Begin VB.TextBox TxtTopic
Height = 375
Index = 2
Left = 480
TabIndex = 18
Top = 1800
Width = 1395
End
Begin VB.TextBox TxtQuality
Height = 375
Index = 1
Left = 6420
TabIndex = 17
Top = 1260
Width = 1395
End
Begin VB.TextBox TxtValue
Height = 375
Index = 1
Left = 4620
TabIndex = 16
Top = 1260
Width = 1395
End
Begin VB.TextBox TxtItem
Height = 375
Index = 1
Left = 2160
TabIndex = 15
Top = 1260
Width = 1395
End
Begin VB.TextBox TxtTopic
Height = 375
Index = 1
Left = 480
TabIndex = 14
Top = 1260
Width = 1395
End
Begin VB.TextBox TxtQuality
Height = 375
Index = 0
Left = 6420
TabIndex = 12
Top = 720
Width = 1395
End
Begin VB.TextBox TxtValue
Height = 375
Index = 0
Left = 4620
TabIndex = 10
Top = 720
Width = 1395
End
Begin VB.TextBox TxtItem
Height = 375
Index = 0
Left = 2160
TabIndex = 8
Top = 720
Width = 1395
End
Begin VB.TextBox TxtTopic
Height = 375
Index = 0
Left = 480
TabIndex = 6
Top = 720
Width = 1395
End
Begin VB.Label Label6
Caption = "Update Rate(msec)"
Height = 375
Left = 2160
TabIndex = 33
Top = 3600
Width = 1395
End
Begin VB.Line Line1
X1 = 4440
X2 = 4440
Y1 = 120
Y2 = 4620
End
Begin VB.Label Label5
Caption = "Quality"
Height = 315
Left = 6420
TabIndex = 13
Top = 360
Width = 795
End
Begin VB.Label Label4
Caption = "Value"
Height = 315
Left = 4620
TabIndex = 11
Top = 360
Width = 795
End
Begin VB.Label Label3
Caption = "Item"
Height = 315
Left = 2160
TabIndex = 9
Top = 360
Width = 795
End
Begin VB.Label Label2
Caption = "Topic"
Height = 315
Left = 480
TabIndex = 7
Top = 360
Width = 795
End
End
Begin VB.Frame Frame1
Caption = "服務器"
Height = 855
Left = 540
TabIndex = 0
Top = 420
Width = 8775
Begin VB.TextBox txtMachine
Height = 315
Left = 4500
TabIndex = 37
Top = 420
Width = 1875
End
Begin VB.CommandButton cmdDisconnect
Caption = "DisConnect"
Height = 375
Left = 7560
TabIndex = 4
Top = 360
Width = 1095
End
Begin VB.CommandButton cmdConnect
Caption = "&Connect"
Enabled = 0 'False
Height = 375
Left = 6480
TabIndex = 3
Top = 360
Width = 1095
End
Begin VB.ComboBox CmbServer
Height = 315
Left = 1920
TabIndex = 1
Top = 420
Width = 2475
End
Begin VB.Label Label1
Caption = "請選擇服務器:"
Height = 315
Left = 480
TabIndex = 2
Top = 420
Width = 1395
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents MyOPCServer As OPCServer
Attribute MyOPCServer.VB_VarHelpID = -1
Dim WithEvents MyOPCGroup As OPCGroup
Attribute MyOPCGroup.VB_VarHelpID = -1
'Set MyOPCServer = New OPCServer
'MyOPCServer.Connect "RSLinx OPC Server"
'
'
'Set MyOPCGroup = MyOPCServer.OPCGroups.Add("Group1")
'MyOPCGroup.IsActive = True
'MyOPCGroup.UpdateRate = 1000
Dim abItemIDs() As String
Dim abClientHandles() As Long
Dim abServerHandles() As Long
Dim abErrors() As Long
Dim i As Long
'itemcount = 5
'
'Dim oOPCItem As rslinxopcautomation.OPCItem
'
'For i = 1 To 5
' abItemIDs(i) = "[" & TxtTopic & "[" & TxtItem(i)
' abClientHandles(i) = i
'Next i
'MyOPCGroup.OPCItems.AddItem itemcount, abItemIDs, abClientHandles, abServerHandles, abErrors
Dim One As OPCItem
Dim Index As Long
Dim OneRead As String
Dim Xie As String
'
'Set One = MyOPCGroup.OPCItem(Index)
'
'One.Read OPCCache
'OneRead = One.Value
'
'One.Write (Xie)
'
'Private Sub MyOPCGroup_DataChange(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, Itemvalues() As Variant, Qualities() As Long, TimeStamps() As Date)
' Dim i As Long
' For i = 1 To NumItems
' TxtValue(ClientHandles(i)) = Itemvalues(i)
' txttime(ClientHandles(i)) = TimeStamps(i)
' txtquantity(ClientHandles(i)) = getqualitystring(Qualities(i))
' Next i
'End Sub
'
'MyOPCServer.OPCGroups.RemoveAll
'Set MyOPCGroup = Nothing
'MyOPCServer.Disconnect
Private Sub CmbServer_Click()
If CmbServer.Text = "" Then cmdConnect.Enabled = False Else cmdConnect.Enabled = True
End Sub
Private Sub cmdAddItems_Click()
Dim oOPCItem As OPCAutomation.OPCItem
Dim i As Long
'Disable command buttons
cmdAsyncRead.Enabled = False
cmdAsyncWrite.Enabled = False
cmdAdvise.Enabled = False
For i = 0 To 3
'clear existing data
TxtValue(i) = ""
TxtQuality(i) = ""
Next 'i
txtStatus = "Adding OPC items ..."
If AddOPCItems Then
'enable command buttons
cmdAsyncRead.Enabled = True
cmdAsyncWrite.Enabled = True
cmdAdvise.Enabled = True
txtStatus = "OPC Items added successfully."
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -