发表于:2004-03-12 19:25:00
楼主
Private Sub Form_Load()
Dim objDriver As Object
Dim szServerName As String
Dim lNumChans As Long
Dim lNumDBs As Long
Dim lNumDevs As Long
Dim vData, vTimeStamp As Variant
Dim vQuality As Variant
Dim i As Long
Dim objMessage As IDriverMessage
szServerName = "Intellution.OPCDrv"
Set objDriver = CreateObject(szServerName)
Set objMessage = New OPCServer
lNumChans = objDriver.GetChannels(vChannelHandles, vchannelnames)
lNumDevs = objDriver.GetDevices(vChannelHandles(0), vDeviceHandles, vDeviceNames)
lNumDBs = objDriver.GetDataBlocks(vDeviceHandles(0), vDataBlockHandles, vDataBlockNames)
vData = objDriver.ReadData(vDataBlockHandles(0), 0, 0, 1, 0, 0, 0, 0, vTimeStamp, vQuality)
Text1 = vchannelnames(0)
Text2 = vDataBlockNames(0)
Text3 = vDataBlockHandles(0)
Text4 = vData(0)
End Sub
-----------------------------------------------------
Text1 = vchannelnames(0)
Text2 = vDataBlockNames(0)
Text3 = vDataBlockHandles(0) 都可以读出数
就是Text4 = vData(0)不可以?