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

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

?? opcgroupclass.cls

?? vb開發的一個opcclient源代碼
?? CLS
?? 第 1 頁 / 共 3 頁
字號:
' parameters are acceptable to the server no error will be returned.

Function ValidateOPCItem(ByVal OPCItemID As String, ByVal DataType As Integer, ByVal ActiveState As Integer, ByRef Error As Long)
         
    Dim Errors() As Long
    Dim ItemCount As Long
    Dim OPCItemIDs(1) As String
    Dim RequestedDataTypes(1) As Integer
   'Set error handling for OPC Function
    On Error GoTo ShowOPCItemValidateError
    
    ' Establish the initial default conditions for new items added to this
    ' group.
    SetOPCItemsDefaultActive (ActiveState)
    SetOPCItemsDefaultDataType (DataType)
    
    OPCItemIDs(1) = OPCItemID
    RequestedDataTypes(1) = DataType
    ItemCount = 1
    
    ' Test the item
    OPCGroupObj.OPCItems.Validate ItemCount, OPCItemIDs, Errors, RequestedDataTypes
    
    ' return any errors
    If Errors(1) <> 0 Then
       Error = Errors(1)
       ValidateOPCItem = False
       GoTo SkipValidateItemError
    End If
    
    ValidateOPCItem = True
    GoTo SkipValidateItemError

ShowOPCItemValidateError:
    Call DisplayOPC_COM_ErrorValue("Validate Item", Err.Number)
    ValidateOPCItem = False
SkipValidateItemError:
    
End Function

' This function performs a single write using the AsyncWrite method
' of the OPCGroup object that is part of the Automation Interface.
' OPC data can be written in one of two ways. Using the Asynchronous
' write as shown here or using a Sychronous write.  Both methods have
' their benefits.  The Synchronous method has the benefit of simplicity.
' When you perform a sync write operation the call is made to the OPC server
' and the server does not return until the write has been completed.  From
' a coding standpoint that can be an easy thing to deal with.  From an
' actual application standpoint it can present some interesting problems.
' As the name implies a Synchronous write operation is synchonized to
' operation of the target OPC server.  When a sync write is issued the call
' will not return until the server has completed the whole write operation.
' If the communications driver you are using is perhaps a serial device
' going over a slow modem link this pause before the sync write returns
' can be considerable.  Having this delay occur in your VB application
' could cause the end user to perceive your VB app as as having bad
' performance simply because it needs to wait for a write to complete.
'
' There is a better way.
'
' The Asynchronous write operation differs from the Synchronous operation
' in two key ways.  First, the Async write does not require the VB
' application to wait until the OPC server completes the write.  Second,
' the Async write requires an event handler to receive the notification
' that the write has completed.
'
' Returning immediately to your VB application from the AsyncWrite
' call makes using the method as easy as the Sync write call but
' an event handler for the write must be used if you want to know
' the true actual result of the write operation.  In this example
' only a single value is written for simplicity.  In your
' application a list of items can be passed to the function
' with equal ease. If an error occurs in processing the command
' you will still see that error returned on the return from the
' AsyncWrite method.
'
' The method you use for writing data to an OPC server can be a
' factor of your application.  If there is no driving reason to use
' a synchronous operation I strongly urge you to use the asynchronous
' methods.  The asynchronous methods allow the OPC server to schedule
' the operaiton you have requested such that it can be processed
' as soon as the server can finish its current operations.  The
' synchronous methods force the OPC server to stop in its tracks
' and attempt to complete the sync operation.  While this may sound
' ideal, it prevents an OPC server from ever being able to optimize
' your overall communications requirements.  If you used all syncchronous
' operations for both read and write data, the OPC server would never
' be able to take advantage of the protocol optimizations that most if
' not all OPC servers perform.
'
Function AsyncWriteOPCItem(ObjectToWrite As OPCItemClass, ValueToWrite As Variant)
    
    Dim ServerHandles(1) As Long
    Dim Errors() As Long
    Dim Count As Long
    Dim TransactionID As Long
    Dim CancelID As Long
    Dim Values(1) As Variant
    'Set error handling for OPC Function
    On Error GoTo ShowOPCItemWriteError
    
    ' Currently the write function is designe to write only
    ' one value at a time. This can easily be changed by simly
    ' increasing the number of item passed in these arrays.
    Count = 1
    
    ' Get the handle of the server we intend to write.
    ServerHandles(1) = ObjectToWrite.GetItemServerHandle
    
    ' Since we are doing only one write and it is driven by
    ' User input the TransactionID can be kept relatively simple.
    ' If you expand the write function to write a random number of
    ' item you will want to use a more complex scheme for a
    ' TransactionID.  Also keep in mind that you can issue muliple
    ' Async write functions which may not complete in any specific
    ' order. With that said use a TransactionID method that can fit
    ' your application.
    TransactionID = 1
    
    ' This example writes only a sinlge value at a time but can be
    ' to send a list of items to the server in a single call.  The
    ' Transaction ID becomes very crucial when sending more than
    ' one write to the server.  If you send a list of items they may
    ' not return in a single event handler call and they may not
    ' return in any specific order.
    Values(1) = ValueToWrite
    
    ' Perform the write.
    OPCGroupObj.AsyncWrite Count, ServerHandles, Values, Errors, TransactionID, CancelID
    
    AsyncWriteOPCItem = True
GoTo SkipItemWriteError

ShowOPCItemWriteError:
    Call DisplayOPC_COM_ErrorValue("Write Item", Err.Number)
    AsyncWriteOPCItem = False
SkipItemWriteError:

End Function


' 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

' If you have something to do when an OPCGroupClass object is created put it here.
Private Sub Class_Initialize()
    ' To Do
End Sub

' If you have somehting to do when an OPCGroupClass object is released put it here.
Private Sub Class_Terminate()
'To Do  We have nothing to be released at this time
End Sub

' ************************************************************
' The Next section of the OPCGroupClass are the event handlers

' This sub handles the 'DataChange' call back event which returns data that has
' been detected as changed within the OPC Server.  This call back should be
' used primarily to receive the data.  Do not make any other calls back into
' the OPC server from this call back.  The other item related functions covered
' in this example have shown how the ItemServerHandle is used to control and
' manipulate individual items in the OPC server.  The 'DataChange' event allows
' us to see how the 'ClientHandles we gave the OPC Server when adding items are
' used.  As you can see here the server returns the 'ClientHandles' as an array.
' The number of item returned in this event can change from trigger to trigger
' so don't count on always getting a 1 to 1 match with the number of items
' you have registered.  That's where the 'ClientHandles' come into play.  Using
' the 'ClientHandles' returned here you can determine what data has changed and
' where in your application the data should go.  In this example the
' 'ClientHandles' were the Index number of each item we added to the group.
' Using this returned index number the 'DataChange' handler shown here knows
' what items in the collection need to be updated with new data.
'
Private Sub OPCGroupObj_DataChange(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)
    ' We don't have error handling here since this is an event called from the OPC interface
    
    On Error Resume Next
 
    Dim UpdateItem As OPCItemClass
    Dim i As Integer
    
    For i = 1 To NumItems
        ' Get OPCItemClass object from the collection that is kept by
        ' the OPCGroupClass object.  This is found by using the client handle
        ' returned from the server for each item being returned in this event
        ' as the Item Key within the collection.
        Set UpdateItem = OPCGroupItems.Item(Str(ClientHandles(i)))
        ' If the item is valid then update the contents of the item.  For this
        ' example the contents of the item will then be displayed in the
        ' list box of the application.  For your application you can be assured
        ' that any time you need to access an OPC item in this group that it
        ' will contain the latest data.  Like the Listbox used in this example,
        ' your application  must keep track of the data item it desires by
        ' using the item collection key.
        If Not UpdateItem Is Nothing Then
            UpdateItem.UpdateOPCItemData ItemValues(i), Qualities(i), TimeStamps(i)
        End If
    Next i

End Sub

' This sub handles 'AsyncWriteComplete' call back event that occurs
' whenever an AsyncWrite operation is issued to the OPC server.  As
' discussed in the AsyncWriteOPCItem, the AsyncWriteComplete call back
' event allows your application to determine the results of a write
' operation that has been issued at some other point in your application.
' When using the asynchronous write function there is no way to know how
' or if a write operation has completed successfully when the write is
' issued.  The server must inform your application of the results of the
' write operation. Using the transaction ID and ClientHandles you can
' associate each complete event with a specific OPC item.  In this example
' the Item quality field of an item is simply updated to reflect the results
' of the write.
'
' In your application may want to use the asynchronous write complete event
' as a trigger to send addtional data to the OPC server.  In all cases it is
' suggested that no other OPC operation be issued from within the call
' back event.

Private Sub OPCGroupObj_AsyncWriteComplete(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, Errors() As Long)
    Dim UpdateItem As OPCItemClass
    Dim i As Integer
    
    For i = 1 To NumItems
        ' Get OPCItemClass object from the collection that is kept by
        ' the OPCGroupClass object.  This is found by using the client handle
        ' returned from the server for each item being returned in this event
        ' as the Item Key within the collection.
        Set UpdateItem = OPCGroupItems.Item(Str(ClientHandles(i)))
        
        ' If the item is valid then check the error flag for the item and
        ' clear the item's quality field.  Setting to zero is considered an
        ' error for an OPC item quality value.
        If Not UpdateItem Is Nothing Then
            If Errors(i) Then
                UpdateItem.SetItemQuality (0)
            End If
        End If
    Next i
End Sub

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
最新日韩在线视频| 欧美精品三级日韩久久| 26uuu国产在线精品一区二区| 久久精品一区蜜桃臀影院| 强制捆绑调教一区二区| 91.麻豆视频| 图片区小说区国产精品视频| 在线精品视频小说1| 一区二区三区在线视频观看| 色综合色综合色综合 | 国产亚洲欧美在线| 久久av资源网| 精品国产三级电影在线观看| 蓝色福利精品导航| 精品国产一区二区三区久久影院 | 色视频成人在线观看免| 国产精品国产精品国产专区不蜜| 国产成人av电影在线观看| 久久视频一区二区| 奇米精品一区二区三区在线观看一| 欧美剧情电影在线观看完整版免费励志电影 | 日韩精品一二三| 欧美一区二区三区在线| 美女一区二区三区| 国产无一区二区| 91亚洲精华国产精华精华液| 亚洲国产精品v| 色欲综合视频天天天| 亚洲成av人片一区二区三区| 在线91免费看| 日本美女一区二区三区视频| 欧美sm美女调教| 福利91精品一区二区三区| 亚洲国产经典视频| 欧美日韩免费观看一区二区三区| 午夜国产不卡在线观看视频| 精品国产区一区| 99视频精品在线| 亚洲一区二区三区小说| 日韩免费性生活视频播放| 国产v综合v亚洲欧| 夜夜夜精品看看| 日韩欧美激情一区| 波多野结衣精品在线| 亚洲国产欧美另类丝袜| 精品国产不卡一区二区三区| av一区二区三区四区| 日韩影院在线观看| 国产精品国产三级国产aⅴ入口| 91成人国产精品| 韩国av一区二区三区四区| 亚洲人成7777| 久久伊人蜜桃av一区二区| 91久久精品国产91性色tv| 久久99精品久久久| 亚洲精品你懂的| 欧美精品一区二区三区蜜桃| 色菇凉天天综合网| 国产一二精品视频| 亚洲成人在线网站| 国产精品久久久久久久浪潮网站| 在线成人小视频| caoporen国产精品视频| 老司机午夜精品| 有坂深雪av一区二区精品| 久久久久国产成人精品亚洲午夜| 欧美色男人天堂| 成人福利电影精品一区二区在线观看| 手机精品视频在线观看| 欧美激情一二三区| 日韩一本二本av| 色噜噜狠狠色综合中国| 国产精品资源在线观看| 五月婷婷激情综合网| 精品国产欧美一区二区| 在线观看不卡一区| 国产91丝袜在线播放九色| 午夜久久久久久久久久一区二区| 中文一区二区在线观看| 欧美一区二区黄| 精品视频在线看| 色噜噜狠狠一区二区三区果冻| 国产成人午夜精品影院观看视频 | 久久这里只精品最新地址| 亚洲精品视频在线观看网站| 国产情人综合久久777777| 国产午夜三级一区二区三| 国产欧美日韩麻豆91| 中文字幕av一区二区三区| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲h精品动漫在线观看| 亚洲一区二区在线视频| 亚洲图片欧美色图| 首页国产丝袜综合| 激情综合五月天| 国精产品一区一区三区mba视频 | 欧美日韩国产成人在线91| 欧美理论电影在线| 精品国产免费一区二区三区四区| 久久精品一区二区三区不卡| 国产精品理论在线观看| 亚洲女人****多毛耸耸8| 亚洲午夜国产一区99re久久| 无码av免费一区二区三区试看| 久久机这里只有精品| www.成人在线| 欧美日韩国产小视频在线观看| 欧美一区二区视频观看视频| 国产女主播视频一区二区| 亚洲美腿欧美偷拍| 青青草原综合久久大伊人精品优势 | 欧美一级理论性理论a| 精品成人一区二区三区四区| 综合在线观看色| 五月天精品一区二区三区| 国产最新精品精品你懂的| 99久久国产综合色|国产精品| 欧美日本不卡视频| 久久久精品天堂| 亚洲一区二区成人在线观看| 国内外精品视频| 91麻豆swag| 久久色在线观看| 亚洲高清视频中文字幕| 国产传媒日韩欧美成人| 欧美理论电影在线| 最新久久zyz资源站| 日韩av高清在线观看| 99久久精品免费| 精品国产乱码久久久久久久| 亚洲激情校园春色| 成人在线视频首页| 日韩三级视频中文字幕| 亚洲另类春色国产| 国产不卡在线播放| 日韩一区二区三区三四区视频在线观看| 国产免费久久精品| 麻豆久久久久久| 欧美三区在线视频| 亚洲视频在线一区| 国产美女在线精品| 日韩欧美激情一区| 亚洲成人动漫av| 91亚洲精华国产精华精华液| 国产日本欧洲亚洲| 精品一区二区三区影院在线午夜 | 亚洲国产精品久久人人爱蜜臀| 国产mv日韩mv欧美| 26uuu精品一区二区三区四区在线| 午夜伦欧美伦电影理论片| 色综合久久天天| 国产精品天天摸av网| 国产一区视频网站| 欧美r级在线观看| 男女视频一区二区| 91精品在线一区二区| 亚洲成人综合网站| 欧美三级在线播放| 亚洲综合久久久| 色先锋资源久久综合| 亚洲视频网在线直播| 国产二区国产一区在线观看| 精品久久久久久无| 另类小说一区二区三区| 欧美丰满少妇xxxbbb| 天天操天天干天天综合网| 欧美电影在线免费观看| 亚洲午夜在线视频| 欧洲国内综合视频| 一卡二卡欧美日韩| 欧美自拍偷拍一区| 亚洲国产综合在线| 欧美日韩黄视频| 亚洲高清久久久| 7777精品伊人久久久大香线蕉| 午夜伦理一区二区| 日韩一区二区在线观看视频播放 | 国产在线播放一区二区三区| 精品国产髙清在线看国产毛片| 激情综合五月天| 亚洲国产成人午夜在线一区| 风间由美性色一区二区三区| 国产精品国产精品国产专区不蜜| 99久久伊人网影院| 亚洲综合免费观看高清完整版 | av日韩在线网站| 亚洲欧美激情视频在线观看一区二区三区| 99久久久久久99| 午夜精品久久久久久不卡8050| 日韩视频免费观看高清完整版 | 成人av资源站| 亚洲女厕所小便bbb| 欧美精品自拍偷拍动漫精品| 国产九色sp调教91| 亚洲欧洲成人自拍| 欧美精品成人一区二区三区四区| 激情图区综合网| 综合电影一区二区三区| 欧美喷潮久久久xxxxx| 国产在线视频精品一区|