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

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

?? kepserverex_simple_vb_opc.frm

?? vb6.0與OPCSERVER的完整例子
?? FRM
?? 第 1 頁 / 共 5 頁
字號:
    ' Items can't be added without a group so prevent the user from editing them.
    OPCAddItems.Enabled = False
    Dim i As Integer
    For i = 0 To 9
       OPCItemName(i).Enabled = False
    Next i
    
    ' Enable the Disconnect Server button since we have removed the group and can disconnect from the server properly
    DisconnectFromServer.Enabled = True
End If

    GoTo SkipRemoveGroupError

ShowOPCGroupRemoveError:
    Call DisplayOPC_COM_ErrorValue("Remove Group", Err.Number)
SkipRemoveGroupError:
End Sub

' This sub allows the group's active state to be changed on the fly.  The
' OPCGroup object provides a number of properties that can be used to control
' a group's operation.  The '.IsActive' property allows you to turn all of the
' OPC items in the group On(active) and Off(inactive).  To see the effect that
' the group's '.InActive' property has on an OPC Server run this demo and connect
' with KEPServer, add the default group, add the default items.  Once you see
' changing data click on the CheckBox in the Group frame.  If you watch
' the KEPServer OPC Server you will see it's active tag count go from 10 when
' updating to 'No Active Items' when the group is made inactive.
' Changing the actvie state of a group can be useful in controlling how your
' application makes use of an OPC Servers communication bandwidth.  If you don't
' need any of the data in a given group simply set it inactive, this will allow an
' OPC Server to gather only the data current required by your application.
Private Sub GroupActiveState_Click()
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGroupActiveError
    
    ' If the group has been added and exist then change its active state
    If Not ConnectedGroup Is Nothing Then
        ConnectedGroup.IsActive = GroupActiveState.Value
    End If

    GoTo SkipGroupActiveError

ShowOPCGroupActiveError:
    Call DisplayOPC_COM_ErrorValue("Group Active State", Err.Number)
SkipGroupActiveError:
    
End Sub

' This sub allows the group's deadband to be changed on the fly.  Like the
' '.IsActive' property, the '.DeadBand' property can be changed at any time.
' The Deadband property allows you to control how much change must occur in
' an OPC item in this group before the value will be reported in the 'DataChange'
' event.  The value entered for '.DeadBand' is 0 to 100 as a percentage of full
' scale for each OPC item data type within this group.  If your OPC item is a
' Short(VT_I2) then your full scale is -32768 to 32767 or 65535.  If you
' enter a Deadband value of 1% then all OPC Items in this goup would need
' to change by a value of 655 before the change would be returned in the
' 'DataChange' event.  The '.DeadBand' property is a floating point number
' allowing very small ranges of change to be filtered.
Private Sub GroupDeadBand_Change()
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGroupDeadBandError
    
    ' If the group has been added and exist then change its dead band
    If Not ConnectedGroup Is Nothing Then
        ConnectedGroup.DeadBand = Val(GroupDeadBand.Text)
    End If

    GoTo SkipGroupDeadBandError

ShowOPCGroupDeadBandError:
    Call DisplayOPC_COM_ErrorValue("Group Dead Band", Err.Number)
SkipGroupDeadBandError:
End Sub

' This sub allows the group's update rate to be changed on the fly.  The
' '.UpdateRate' property allows you to control how often data from this
' group will be returned to your application in the 'DataChange' event.
' The '.UpdateRate' property can be used to control and improve the overall
' performance of you application.  In this example you can see that the update
' rate is set for maximum update speed.  In a demo that's OK.  In your real
' world application, forcing the OPC Server to gather all of the OPC items in
' a group at their fastest rate may not be ideal.  In applications where you
' have data that needs to be acquired at different rates you can create
' multiple groups each with its own update rate.  Using multiple groups would
' allow you to gather time critical data in GroupA with an update rate
' of 200 millliseconds, and gather low priority data from GroupB with an
' update rate of 7000 milliseconds.  The lowest value for the '.UpdateRate'
' is 0 which tells the OPC Server go as fast as possible.  The maximium is
' 2147483647 milliseconds which is about 596 hours.
Private Sub GroupUpdateRate_Change()
    'Set error handling for OPC Function
    On Error GoTo ShowOPCGroupUdateRateError
    
    ' If the group has been added and exist then change its update rate
    If Not ConnectedGroup Is Nothing Then
        ConnectedGroup.UpdateRate = Val(GroupUpdateRate.Text)
    End If

    GoTo SkipGroupUdateRateError

ShowOPCGroupUdateRateError:
    Call DisplayOPC_COM_ErrorValue("Group Update Rate", Err.Number)
SkipGroupUdateRateError:
End Sub

' This sub handles adding an OPC item to a group.  The group must be established first before
' any items can be added.  Once you  have a group added to the OPC Server you
' need to add item to the group.  The OPCItems object provides the methods and
' properties need to add item to an estabished OPC group.
Private Sub OPCAddItems_Click()
    'Set error handling for OPC Function
    On Error GoTo ShowOPCItemAddError
    
    ' In this example we have at most 10 items that we will attempt to add
    ' to the group.
    ItemCount = 10
    '
    ' Load the request OPC Item names and build the ClientHandles list
    Dim i As Integer
    For i = 0 To 9
        ' Load the name of then item to be added to this group.  You can add
        ' as many items as you want to the group in a single call by building these
        ' arrays as needed.
        OPCItemIDs(i + 1) = OPCItemName(i).Text
        
        ' The client handles are given to the OPC Server for each item you intend
        ' to add to the group.  The OPC Server will uses these client handles
        ' by returning them to you in the 'DataChange' event.  You can use the
        ' client handles as a key to linking each valued returned from the Server
        ' back to some element in your application.  In this example we are simply
        ' placing the Index number of each control that will be used to display
        ' data for the item.  In your application the ClientHandle value you use
        ' can by whatever you need to best fit your program.  You will see how
        ' these client handles are used in the 'DataChange' event handler.
        ClientHandles(i + 1) = i
        
        ' Make the Items active start control Active, for the demo I want all itme to start active
        ' Your application may need to start the items as inactive.
        OPCItemActiveState(i).Value = 1
    Next i

    ' Establish a connection to the OPC item interface of the connected group
    Set OPCItemCollection = ConnectedGroup.OPCItems
    
    ' Setting the '.DefaultIsActive' property forces all items we are about to
    ' add to the group to be added in an active state.  If you want to add them
    ' all as inactive simply set this property false, you can always make the
    ' items active later as needed using each item's own active state property.
    ' One key distinction to note, the active state of an item is independent
    ' from the group active state.  If a group is active but the item is
    ' inactive no data will be received for the item.  Also changing the
    ' state of the group will not change the state of an item.
    OPCItemCollection.DefaultIsActive = True
    
    ' Atempt to add the items,  some may fail so the ItemServerErrors will need
    ' to be check on completion of the call.  We are adding all item using the
    ' default data type of VT_EMPTY and letting the server pick the appropriate
    ' data type.  The ItemServerHandles is an array that the OPC Server will
    ' return to your application.  This array like your own ClientHandles array
    ' is used by the server to allow you to reference individual items in an OPC
    ' group.  When you need to perform an action on a single OPC item you will
    ' need to use the ItemServerHandles for that item.  With this said you need to
    ' maintain the ItemServerHandles array for use throughout your application.
    ' Use of the ItemServerHandles will be demonstrated in other subroutines in
    ' this example program.
    OPCItemCollection.AddItems ItemCount, OPCItemIDs, ClientHandles, ItemServerHandles, ItemServerErrors
    
    ' This next step checks the error return on each item we attempted to
    ' register.  If an item is in error it's associated controls will be
    ' disabled.  If all items are in error then the Add Item button will
    ' remain active.
    Dim AnItemIsGood As Boolean
    AnItemIsGood = False
    For i = 0 To 9
        If ItemServerErrors(i + 1) = 0 Then ' If the item was added successfully then allow it to be used.
            OPCItemValueToWrite(i).Enabled = True
            OPCItemWriteButton(i).Enabled = True
            OPCItemActiveState(i).Enabled = True
            OPCItemSyncReadButton(i).Enabled = True
            AnItemIsGood = True
        Else
            ItemServerHandles(i + 1) = 0 ' If the handle was bad mark it as empty
            OPCItemValueToWrite(i).Enabled = False
            OPCItemWriteButton(i).Enabled = False
            OPCItemActiveState(i).Enabled = False
            OPCItemSyncReadButton(i).Enabled = False
        End If
        
    Next i
        
    ' Disable the Add OPC item button if any item in the list was good
    If AnItemIsGood Then
        OPCAddItems.Enabled = False
        For i = 0 To 9
            OPCItemName(i).Enabled = False ' Disable the Item Name cotnrols while now that they have been added to the group.
        Next i
        RemoveOPCGroup.Enabled = False  ' If an item has been don't allow the group to be removed until the item is removed
        OPCRemoveItems.Enabled = True
    Else
        ' The OPC Server did not accept any of the items we attempted to enter, let the user know to try again.
        Dim Response
        Response = MsgBox("The OPC Server has not accepted any of the item you have enter, check your item names and try again.", vbOKOnly, "OPC Add Item")
    End If

    GoTo SkipOPCItemAddError

ShowOPCItemAddError:
    Call DisplayOPC_COM_ErrorValue("OPC Add Items", Err.Number)
SkipOPCItemAddError:
End Sub

' This sub handles removing OPC items from a group.  Like the 'AddItems' method
' of the OPCItems object, the 'Remove' method allow us to remove item from
' an OPC group.  In this example we are removing all item from the group.
' In your application you may find it necessary to remove some items from
' a group while ading others.  Normally the best practice however it to add
' all the item you wish to use to the group and then control their active
' states indivudually.  You can control the active state of individual items
' in a group as shown in the 'OPCItemActiveState_Click' subroutine of this
' module.  With that said if you intend to remove the group you
' should first remove all its items.  The 'Remove' method uses the
' ItemServerHandles we received from the 'AddItems' method to properly remove
' only the items you wish.  This is an example of how ItemServerHandles are
' used by your application and the OPC Server.  As stated above, you can
' design your application to add and remove items as needed but that's not
' necessarily the most effiecent operation for the OPC Server.
Private Sub OPCRemoveItems_Click()
    If Not OPCItemCollection Is Nothing Then
        'Set error handling for OPC Function
        On Error GoTo ShowOPCRemoveItemError
    
        ItemCount = 1
        
        ' Provide an array to contain the ItemServerHandles of the item
        ' we intend to remove
        Dim RemoveItemServerHandles(10) As Long
        
        ' Array for potential error returns.  This example doesn't
        ' check them but yours should ultimately.
        Dim RemoveItemServerErrors() As Long
                
        ' Get the Servers handle for the desired items.  The server handles
        ' were returned in add item subroutine.  In this case we need to get
        ' only the handles for item that are valid.
        Dim i As Integer
        For i = 1 To 10
            ' In this example if the ItemServerHandle is non zero it is valid
            If ItemServerHandles(i) <> 0 Then
                RemoveItemServerHandles(ItemCount) = ItemServerHandles(i)
                ItemCount = ItemCount + 1
            End If
        Next i
    
        ' Item count is 1 greater than it needs to be at this point
        ItemCount = ItemCount - 1
        
        ' Invoke the Remove Item operation.  Remember this call will
        ' wait until completion
        OPCItemCollection.Remove ItemCount, RemoveItemServerHandles, RemoveItemServerErrors
    
        ' Clear the ItemServerHandles and turn off the controls for interacting
        ' with the OPC items on the form.
        For i = 0 To 9
            ItemServerHandles(i + 1) = 0 'Mark the handle as empty
            OPCItemValueToWrite(i).Enabled = False
            OPCItemWriteButton(i).Enabled = False
            OPCItemActiveState(i).Enabled = False
            OPCItemSyncReadButton(i).Enabled = False
        Next i
        
        ' Enable the Add OPC item button and Remove Group button now that the
        ' items are released
        OPCAddItems.Enabled = True
        RemoveOPCGroup.Enabled = True
        OPCRemoveItems.Enabled = False
        
        ' Enable the OPC Item name controls to allow a new set of items
        ' to be entered
        For i = 0 To 9
            OPCItemName(i).Enabled = True
        Next i
    
        ' Release the resources by the item collection interface
        Set OPCItemCollection = Nothing
   
    End If
            
        GoTo SkipOPCRemoveItemError

ShowOPCRemoveItemError:
    Call DisplayOPC_COM_ErrorValue("OPC Remove Items", Err.Number)
SkipOPCRemoveItemError:

End Sub

' This sub handles writing a single value to the server using the
' 'SyncWrite' write method.  The 'SyncWrite' method provides a
' quick(programming wise) means to send a value to an OPC Server.  The item
' you intend to write must already be part of an OPC group you have added
' and you must have the ItemServerHandle for the item.  This is another example
' of how the ItemServerHandle is used and why it is important to properly
' store and track these handles.  The 'SyncWrite' method while quick and easy
' will wait for the OPC Server to complete the operation.  Once you invoke
' the 'SyncWrite' method it could take a moment for the OPC Server to return
' control to your application.  For this example that's OK.  If your application
' can't tolerate a pause you can use the 'AsyncWrite' and its associated
' 'AsyncWriteComplete' call back event instead.  In this sub we are only
' writing one value at a time.  The 'SyncWrite' mehtod can take a list of
' writes to be performed allow you to write entire recipes to the server
' in one shot.  If you are going to write more than one item, the
' ItemServerHandles for each item must be from the same OPC Group.
Private Sub OPCItemWriteButton_Click(Index As Integer)
    'Set error handling for OPC Function
    On Error GoTo ShowOPCSyncWriteError
  
    ' Write only 1 item
    ItemCount = 1
    ' Create some local scope variables to hold the value to be sent.
    ' These arrays could just as easily contain all of the item we have added.
    Dim SyncItemValues(1) As Variant
    Dim SyncItemServerHandles(1) As Long
    Dim SyncItemServerErrors() As Long
    
    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天av天天翘天天综合网| 日韩欧美在线网站| 高潮精品一区videoshd| 精品制服美女丁香| 久久精品国产精品亚洲红杏| 五月婷婷综合激情| 日韩国产在线观看| 日韩精品一二三| 日韩1区2区3区| 蜜臀av一区二区三区| 蜜臀av亚洲一区中文字幕| 蜜臀久久99精品久久久久宅男| 偷拍一区二区三区四区| 免费国产亚洲视频| 国产精品资源在线看| 成人国产精品视频| 91麻豆精品秘密| 欧美久久久影院| 日韩一区二区免费在线电影| 久久久综合九色合综国产精品| 久久久亚洲午夜电影| 成人欧美一区二区三区黑人麻豆| 亚洲色图欧美在线| 青青草精品视频| 国产毛片精品视频| 在线视频欧美精品| 欧美一区二区三区在线视频| 国产日韩欧美电影| 亚洲一区在线观看免费观看电影高清 | 国产精品正在播放| 欧美丰满美乳xxx高潮www| 日韩欧美国产wwwww| 国产精品乱人伦一区二区| 亚洲你懂的在线视频| 男人操女人的视频在线观看欧美 | 中文字幕av一区二区三区免费看| 国产精品美女久久久久久久网站| 亚洲精品久久久久久国产精华液| 免费视频一区二区| 一本大道久久精品懂色aⅴ| 日韩午夜在线观看| 亚洲综合在线观看视频| 国产真实乱子伦精品视频| 在线免费亚洲电影| 国产欧美日产一区| 青草国产精品久久久久久| 色综合久久88色综合天天免费| 久久综合久久综合亚洲| 亚洲福利一区二区三区| 成人aa视频在线观看| 日韩精品一区二区三区老鸭窝| 亚洲码国产岛国毛片在线| 国产精品一线二线三线| 在线播放视频一区| 一区二区三区在线看| 成人中文字幕合集| 久久久91精品国产一区二区精品| 午夜精品一区在线观看| 色丁香久综合在线久综合在线观看| 久久久久久久久久久久电影| 日韩在线一二三区| 欧美日韩午夜在线视频| 亚洲色图一区二区三区| 成人av电影免费观看| 国产欧美日韩精品一区| 狠狠狠色丁香婷婷综合久久五月| 欧美日韩和欧美的一区二区| 亚洲免费av高清| 日本黄色一区二区| 亚洲三级电影全部在线观看高清| 成人美女视频在线看| 国产欧美日韩三级| 成人污视频在线观看| 国产亚洲美州欧州综合国| 精品一区二区三区蜜桃| 精品欧美一区二区在线观看| 精品一二线国产| 久久久久久久久久美女| 国产999精品久久| 欧美激情一区二区在线| 国产99久久久久| 亚洲国产精品传媒在线观看| 成人激情文学综合网| 国产精品国产三级国产三级人妇| 菠萝蜜视频在线观看一区| 亚洲三级在线播放| 在线观看一区二区精品视频| 亚洲一区二区在线播放相泽| 欧美日韩日日摸| 九九热在线视频观看这里只有精品| 日韩你懂的在线观看| 国产成人亚洲综合a∨猫咪| 欧美激情中文字幕| 色婷婷综合视频在线观看| 亚洲第一福利一区| 精品国产不卡一区二区三区| 国产精品2024| 亚洲综合在线观看视频| 日韩午夜在线播放| av午夜精品一区二区三区| 亚洲一区在线免费观看| 精品国产91久久久久久久妲己| 国产白丝网站精品污在线入口| 夜夜精品浪潮av一区二区三区| 欧美电影在线免费观看| 国产成人免费9x9x人网站视频| 亚洲免费看黄网站| 精品美女一区二区| 91热门视频在线观看| 麻豆一区二区在线| 中文字幕日本不卡| 欧美一卡在线观看| 91色.com| 国产一区不卡视频| 亚洲成人免费视| 欧美国产一区二区| 91精品在线麻豆| 972aa.com艺术欧美| 麻豆中文一区二区| 亚洲综合图片区| 中文字幕欧美日本乱码一线二线 | 欧美一区二区观看视频| 成人动漫在线一区| 老司机精品视频一区二区三区| 中文字幕一区不卡| 欧美精品一区二区三区高清aⅴ | 成人高清av在线| 老司机精品视频在线| 午夜日韩在线观看| 亚洲人成网站精品片在线观看| 精品国产一区二区三区av性色| 欧美亚洲愉拍一区二区| 国产999精品久久久久久绿帽| 麻豆成人免费电影| 三级亚洲高清视频| 亚洲一二三四久久| 亚洲精选一二三| 国产精品乱码一区二区三区软件| 欧美www视频| 欧美一区二区视频观看视频| 欧美精选一区二区| 欧美少妇xxx| 欧美日韩一区二区三区在线看| 91麻豆国产在线观看| 9人人澡人人爽人人精品| 成人app网站| av毛片久久久久**hd| 成人app软件下载大全免费| 国产成人高清视频| 国产精品 欧美精品| 国产综合色视频| 国产一区二区三区免费| 国产一区在线观看视频| 激情六月婷婷综合| 国产精品一区二区男女羞羞无遮挡| 麻豆精品在线看| 精品一区二区三区视频 | 99re成人在线| 95精品视频在线| 欧美主播一区二区三区美女| 欧美性色欧美a在线播放| 欧美日韩一区久久| 91精品国产日韩91久久久久久| 日韩一区二区在线看| 欧美大白屁股肥臀xxxxxx| 日韩精品一区二区三区四区 | 丁香一区二区三区| 99视频有精品| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 在线亚洲欧美专区二区| 欧美日韩高清影院| 日韩三级视频在线观看| 国产午夜亚洲精品不卡| 综合久久久久久| 日韩av电影免费观看高清完整版| 老司机午夜精品99久久| 国产精品一二三四五| 91啪亚洲精品| 欧美日本一道本在线视频| 26uuu另类欧美亚洲曰本| 国产精品美女久久久久av爽李琼| 亚洲综合色噜噜狠狠| 蜜臀精品久久久久久蜜臀| 成人性生交大片免费看中文网站| 在线观看视频欧美| 精品免费国产一区二区三区四区| 国产精品进线69影院| 偷拍与自拍一区| av中文字幕不卡| 日韩午夜激情视频| 亚洲男女毛片无遮挡| 美女网站色91| 色婷婷国产精品| 2024国产精品视频| 亚洲成av人片在线观看| 国产.精品.日韩.另类.中文.在线.播放| 欧美一区二区精品| 1000精品久久久久久久久| 经典三级一区二区| 欧美无砖专区一中文字|