亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? opcserverclass.cls

?? 很好的Kepware的VB的OPC Client例子.
?? CLS
?? 第 1 頁 / 共 3 頁
字號:
    Rate = ServerGroups.DefaultGroupUpdateRate
    GetDefaultGroupUpdateRate = True
    GoTo SkipOPCGetDefaultUpdateRateError
    
ShowOPCGetDefaultUpdateRateError:
    Call DisplayOPC_COM_ErrorValue("GetDefaultGroupUpdateRate", Err.Number)
    GetDefaultGroupUpdateRate = False
    
SkipOPCGetDefaultUpdateRateError:
End Function


' The name say it all, gets the default DeadBand from the
' ServerGroups collection object.
'
Function GetDefaultGroupDeadBand(ByRef DeadBand As Single)
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGetDefaultGroupDeadBandError
    
    DeadBand = ServerGroups.DefaultGroupDeadband
    GetDefaultGroupDeadBand = True
    GoTo SkipOPCGetDefaultGroupDeadBandError
    
ShowOPCGetDefaultGroupDeadBandError:
    Call DisplayOPC_COM_ErrorValue("GetDefaultGroupDeadBand", Err.Number)
    GetDefaultGroupDeadBand = False
    
SkipOPCGetDefaultGroupDeadBandError:
End Function


' This sub handles adding the group to the OPC server and
' establishing the group interface.  When adding a group you
' can preset some of the group parameters using the properties
' '.DefaultGroupIsActive' and '.DefaultGroupDeadband'.  Set these
' before adding the group. Once the group has been successfully
' added you can change these same settings along with the group
' update rate on the fly using the properties on the resulting
' OPCGroupClass object.
' The GroupName parameter is the name your would like to use for
' the new group to be added.  This paramter can be left blank.
' When you leave the group name blank you are telling the OPC server
' that is should generate a group name for us.  See the SetDefault
' functions above for details on the UpdateRate, DeadBand, and active
' state of the group.
'
' The GroupKey is string that will be returned to the VB application.
' This string can be used as a key for this group in a collection.
'
Function AddOPCGroup(GroupName As String, UpdateRate As Long, DeadBand As Single, ActiveState As Boolean, ByRef GroupKey As String)
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGroupAddError
    
    ' Create an new instance of the OPCGroupClass
    Dim ConnectedGroup As New OPCGroupClass
    Dim NewGroup As OPCGroup
    Dim GroupNum As Integer
              
    ' Establish the initial default conditions for new groups added to this
    ' server.
    SetDefaultGroupIsActive (ActiveState)
    SetDefaultGroupUpdateRate (UpdateRate)
    SetDefaultGroupDeadBand (DeadBand)

    ' Normally you can name an OPC group yourself but
    ' you also have the option of allowing the OPC Server
    ' to provide you with a unique group name automatically.
    ' To do this simply leave the GroupName empty.
    ' This blank group name is then passed to the OPC
    ' server which will recognize this as a automatic
    ' group name.  The server will return the name it
    ' generates as part of the Automation Interface's
    ' OPCGroup object.
    
    Set NewGroup = ServerGroups.Add(GroupName)
    
    
    ' If the GroupName was passed in as blank then get the group
    ' name that the OPC Server has automatically generated.
    If GroupName = "" Then
        GroupName = NewGroup.Name
    End If
    
    ' The FindNextGroupNumber handles getting a unique group number
    ' if you continue to add groups to your OPCServerClass object
    ' this function simply returns the next group number.  If you
    ' delete a group that was previously added this function will
    ' attempt to find the deleted group numbers and use them first.
    ' This prevents the group index numbers from just continuing to
    ' increment.
    GroupNum = FindNextGroupNumber
    
    ' Once the next group number is found a unique group key is
    ' developed.  This key can be used in your application to manage
    ' access to this group.  One example might be to use the GroupKey
    ' returned here as a key within a TreeView of ListView control.
    ' As you can see here the group key is comprise of the group
    ' index specifically for this group and on the server index.
    ' By combining these two index numbers in one key we can be
    ' resonably sure that the group key will be unique across
    ' multiple OPC server groups.
    GroupKey = "Group" + Str(GroupNum) + Str(OPCServerIndex)
    
    ' On the outside chance the OPC server didn't generated a group name
    ' we can create one from the Groupkey.
    If GroupName = "" Then
        GroupName = GroupKey
    End If
   
    ' This sets the basic properties of the OPCGroupClass object
    ConnectedGroup.SetOPCGroup NewGroup, GroupName, GroupKey, GroupNum
    
    ' Although the OPCGroups (ServerGroups) object is already a
    ' collection we need to have our own OPCGGroupClass object wrapper
    ' to contain the properties and events for each group we intend
    ' to add to the server.  This means that we must keep the
    ' ServerGroups collection and the OPCServerGroups collection
    ' in sync.
    With OPCServerGroups
        .Add ConnectedGroup, GroupKey
    End With
        
    AddOPCGroup = True
    GoTo SkipAddGroupError

ShowOPCGroupAddError:
    Call DisplayOPC_COM_ErrorValue("Add Group", Err.Number)
    AddOPCGroup = False
    
SkipAddGroupError:
End Function


' This function attempts to keep the Group index number
' from continuosly growing by finding a group number that
' may have been deleted and returning those first before
' going to the next group index number. The end result of
' this function it that the group number will never grow
' beyond actual number of groups.
'
Private Function FindNextGroupNumber()
    ' In this function an error state means that a vacant
    ' group number has been found.
    On Error GoTo FoundNextGroupNumber
    
    Dim i As Integer
    Dim GroupNum As Integer
    
    GroupNum = 1
    
    With OPCServerGroups
        ' This loop tries to access each item in the OPCServerGroups
        ' collection by it's Key.  If an item can not be pulled from the
        ' collection that means the group had been deleted and it's
        ' group number is available.
        For i = 1 To .Count
            GroupNum = i
            .Item ("Group" + Str(i) + Str(OPCServerIndex))
        Next i
        
        ' If we get here all of the group numbers in the collection
        ' exist and a next available group number should be returned.
        If .Count <> 0 Then
            FindNextGroupNumber = i
        Else
            FindNextGroupNumber = 1 ' No count return the first 1
        End If
    End With
    
    GoTo NewGroup
    
FoundNextGroupNumber:
    ' If we get here a group number could not be found in the
    ' OPCServerGroups collection which means that it has been deleted
    ' and is available for a new group addition.
    FindNextGroupNumber = GroupNum
    
NewGroup:
End Function


' This sub handles removing a group from the OPC server.  The group
' is removed from the ServerGroups object which is the collection
' managed by the Automation Interface.  Then the group is removed from
' the OPCServerGroups collection which is managed by the OPCServerClass
'
Function RemoveOPCGroup(GroupKey As String)
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGroupRemoveError
      
    Dim OPCGroupCls As OPCGroupClass
    Set OPCGroupCls = OPCServerGroups.Item(GroupKey)
    Dim GroupName As String
    GroupName = OPCGroupCls.GetGroupName
      
    ' First the group is removed from the actual group collection managed by
    ' the automation interface if it is successful then remove the tiem from the
    ' OPCServerGroups collection
    ServerGroups.Remove GroupName
    
    ' Now we remove it from the OPCServerGroups collection
    ' to allow any final processing on the group to be done
    OPCServerGroups.Remove GroupKey
        
    RemoveOPCGroup = True
    GoTo SkipRemoveGroupError

ShowOPCGroupRemoveError:
    Call DisplayOPC_COM_ErrorValue("Remove Group", Err.Number)
    RemoveOPCGroup = False
    
SkipRemoveGroupError:
End Function


' The OPCServerClass object has the ability to generate an event when
' an OPC server is shutting down.   When an OPC server supports the
' OPC 2.0 data access specification, it has the option of issuing a
' ServerShutDown event to any of it's attached clients.  In the case
' of a VB application the OPCServer oject will signal the
' ServerShutDown event.  This event is handled here in the OPCServerClass
' object.  If this event fires, the ServerShuttingDown event of the
' OPCServerClass object will be fired.  A VB application has the option of
' hooking the ServerShuttingDown event to be informed when the OPC
' connection is going to be lost.
'
Private Sub OPCServerObj_ServerShutDown(ByVal Reason As String)
    ' If we receive a server shut down message we need to release everthing and remove the server
    ' connection.
    RaiseEvent ServerShuttingDown(OPCServerKey)
End Sub


' Create the new OPCServer object when the OPCServerClass object is
' instantiated.
'
Private Sub Class_Initialize()
    Set OPCServerObj = New OPCServer
End Sub


' When the OPCServerClass object is deleted this function will cleanup
' the OPC connection by releasing the groups and items.  While this function
' will clean up the groups and items that may have been attached to this
' OPCServerClass object you will still need to call DisconnectOPCServer
' in your VB application on this object to properly release the OPC Server
' from the Automation Interface.
'
Private Sub Class_Terminate()
    
    ' Normally you should remove all groups and their items from the server
    ' before you remove the server object.  However the OPCGroups collection
    ' object supports a RemoveAll method that will remove all items from
    ' the groups and all groups from the server.
    If Not ServerGroups Is Nothing Then
        If ServerGroups.Count <> 0 Then
            ServerGroups.RemoveAll
        End If
    End If
    
    ' We still need to remove the OPCServerGroups collection that contains
    ' the OPCGroupClasss objects
    If OPCServerGroups.Count <> 0 Then
        Dim i As Integer
        Dim a As Integer
        a = OPCServerGroups.Count
        For i = 1 To OPCServerGroups.Count
            With OPCServerGroups
            .Remove (a)
            a = a - 1
            End With
        Next i
    End If
    
    ' Release the OPCServerGroups collection
    Set OPCServerGroups = Nothing
    
End Sub


' Handles displaying any OPC/COM/VB errors that are caught by the exception handler
Sub DisplayOPC_COM_ErrorValue(OPC_Function As String, ErrorCode As Long)
    Dim Response
    Dim ErrorDisplay As String
    ErrorDisplay = "The OPC function '" + OPC_Function + "' has returned an error of " + Str(ErrorCode) + " or Hex 0x" + Hex(ErrorCode)
    Response = MsgBox(ErrorDisplay, vbOKOnly, "OPC Function Error")
End Sub

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产麻豆免费人成网站| gogogo免费视频观看亚洲一| 国产一区二区三区四区五区入口| 国产麻豆视频一区二区| 99久久精品免费看| 欧美二区在线观看| 国产欧美日韩亚州综合| 亚洲一区二区在线观看视频 | k8久久久一区二区三区| 日本丶国产丶欧美色综合| 91麻豆精品国产无毒不卡在线观看| 欧美成人vps| 一区二区三区不卡在线观看 | 91精品国产综合久久蜜臀| 久久久久亚洲蜜桃| 一区二区三区精品视频| 国产在线看一区| 色综合一个色综合亚洲| 91精品久久久久久久久99蜜臂| 欧美激情在线看| 日本最新不卡在线| 不卡的av在线| 精品国产a毛片| 亚洲美腿欧美偷拍| 国产精品综合av一区二区国产馆| 91福利视频网站| 欧美激情一区二区三区在线| 日韩二区三区在线观看| 色中色一区二区| 国产色一区二区| 日韩综合一区二区| 91麻豆swag| 国产日韩视频一区二区三区| 男女性色大片免费观看一区二区| 91一区在线观看| 久久久久免费观看| 亚洲成年人影院| 色综合视频一区二区三区高清| 久久久三级国产网站| 日本午夜精品视频在线观看 | 亚洲美女少妇撒尿| 国产精品 欧美精品| 日韩欧美一级二级三级| 亚洲一区中文在线| 99久久综合国产精品| 国产人妖乱国产精品人妖| 免费成人av资源网| 欧美美女视频在线观看| 亚洲精品成人在线| www.欧美日韩| 欧美国产综合一区二区| 国产曰批免费观看久久久| 日韩免费高清视频| 日韩高清电影一区| 欧美人狂配大交3d怪物一区| 一区二区三区欧美亚洲| 成年人午夜久久久| 国产精品乱子久久久久| 国产传媒一区在线| 2017欧美狠狠色| 美国一区二区三区在线播放| 7777精品伊人久久久大香线蕉的| 午夜久久久久久| 欧美综合色免费| 一片黄亚洲嫩模| 欧美亚洲一区二区在线| 亚洲线精品一区二区三区八戒| 在线看日本不卡| 亚洲一区在线观看免费| 欧美性一二三区| 亚洲午夜三级在线| 欧美日韩一区小说| 亚洲成a天堂v人片| 在线成人免费视频| 免费人成在线不卡| 日韩欧美国产wwwww| 久久国产精品色婷婷| 欧美电影免费观看高清完整版在线观看| 日本亚洲电影天堂| 精品日韩欧美在线| 国产剧情一区在线| 欧美激情在线一区二区| 99免费精品视频| 一区二区三区 在线观看视频| 欧美影视一区在线| 青草av.久久免费一区| 日韩欧美国产系列| 国产一级精品在线| 亚洲欧洲三级电影| 91国内精品野花午夜精品| 香蕉影视欧美成人| 欧美一区二区久久久| 久久99热国产| 国产精品久久毛片| 在线视频国产一区| 日韩国产精品久久| 久久久久国产一区二区三区四区| 成人美女视频在线看| 亚洲综合色网站| 日韩一区二区精品葵司在线| 国产在线看一区| 综合网在线视频| 欧美撒尿777hd撒尿| 美女在线观看视频一区二区| 国产欧美日本一区视频| 91极品视觉盛宴| 久久精品久久99精品久久| 国产人成亚洲第一网站在线播放 | 亚洲制服丝袜在线| 欧美一区二区不卡视频| 国产91精品入口| 亚洲国产美国国产综合一区二区| 日韩欧美一二三| 一本色道亚洲精品aⅴ| 三级不卡在线观看| 国产欧美一区二区三区网站| 在线观看不卡一区| 精品午夜久久福利影院| 最新国产の精品合集bt伙计| 欧美日本一区二区三区四区| 国产高清不卡一区| 亚洲va欧美va人人爽| 久久精品亚洲一区二区三区浴池| 在线视频中文字幕一区二区| 韩国成人在线视频| 亚洲一区二区精品久久av| 久久久精品中文字幕麻豆发布| 在线看日韩精品电影| 国产精品一区二区三区乱码| 亚洲午夜精品在线| 国产精品无码永久免费888| 欧美肥妇bbw| 色婷婷综合久色| 国内精品免费**视频| 亚洲国产综合视频在线观看| 亚洲国产精品精华液2区45| 91精品国产福利| 91视频国产资源| 国产一区久久久| 亚洲国产精品一区二区尤物区| 欧美国产欧美综合| 欧美va日韩va| 欧美日韩亚洲综合一区二区三区| 日韩午夜av电影| 色婷婷综合久久| 高清久久久久久| 美女高潮久久久| 香港成人在线视频| 亚洲色图一区二区三区| 国产亚洲精品资源在线26u| 欧美一级艳片视频免费观看| 欧日韩精品视频| 一本一道综合狠狠老| 国产ts人妖一区二区| 久久精品国产精品亚洲红杏| 性欧美大战久久久久久久久| 亚洲人成影院在线观看| 国产女人aaa级久久久级| 精品国产91洋老外米糕| 欧美一区欧美二区| 欧美美女喷水视频| 欧美亚洲综合一区| 在线观看av一区二区| 色综合久久综合网| 99久久99久久精品免费观看 | 欧美日本在线视频| 97se狠狠狠综合亚洲狠狠| 国产精品99久久久| 久久97超碰色| 日本sm残虐另类| 日产欧产美韩系列久久99| 午夜电影一区二区| 亚洲r级在线视频| 香蕉加勒比综合久久| 无码av免费一区二区三区试看| 亚洲精品乱码久久久久久 | 色婷婷综合在线| 91年精品国产| aa级大片欧美| 色哟哟一区二区| 色综合久久久久网| 91福利国产精品| 欧美精品视频www在线观看 | 紧缚奴在线一区二区三区| 日韩高清国产一区在线| 蜜桃视频在线观看一区| 久久精品国产久精国产| 久久电影国产免费久久电影 | 日本一区二区成人在线| 国产欧美日韩麻豆91| 国产精品久久久久aaaa樱花| 日韩美女久久久| 亚洲一区二区三区在线播放| 亚洲成人免费在线观看| 青青草伊人久久| 国产一区二区在线看| 丰满白嫩尤物一区二区| 91蜜桃婷婷狠狠久久综合9色| 在线看日本不卡| 56国语精品自产拍在线观看|