J
This is going to be long so I can make sure I cover all my details.
OK here's my problem: I need a VB6 application to read and write data to an OPC server. I can get my application to work locally, but when the app is distributed to another PC it fails.
First thing: DCOM settings good at both ends - I know this b/c I'm using Matrikon OPC browser with success to get to the node, find a server, and get an item.
Second thing: tried using many OPC Automation wrappers, including Kep and some others (I can't remember where I got them). All worked locally, none remotely.
Third thing: yes, the ProgID/CLSID is in both registries. I've gotten the Intellution OPCDATA.OCX working remotely but don't want to use it in the end because it limits me to one group and 50 items.
Fourth thing: I found the Kepware VB samples. The "complex" one was WAY more than I needed, and the "simple" also seemed far more complicated than necessary.
When I run my code on a remote machine I get the Error: Method '~' of Object '~' failed... message.
The only reference is to the Kepware OPC Automation 2.0. (Plus std VB and OLE stuff).
Here's the code block:
Dim WithEvents srvOPC As OPCServer
Private Sub Command1_Click()
Dim intClientHandle As Long
Dim RetVal
Set srvOPC = New OPCServer
srvOPC.Connect "Intellution.OPCiFIX.1", "GOBATTO"
srvOPC.OPCGroups.Add "Group1"
intClientHandle = srvOPC.OPCGroups(1).ClientHandle
srvOPC.OPCGroups(1).OPCItems.AddItem "Fix.WRITE_TEST.F_CV", intClientHandle
srvOPC.OPCGroups(1).OPCItems(1).Read OPCDevice
RetVal = srvOPC.OPCGroups(1).OPCItems(1).Value
MsgBox (">" & RetVal & "<")
RetVal = CInt(RetVal) + 1
srvOPC.OPCGroups(1).OPCItems(1).Write RetVal
RetVal = srvOPC.OPCGroups(1).OPCItems(1).Value
MsgBox (">" & RetVal & "<")
Set grpOPC = Nothing
srvOPC.OPCGroups.RemoveAll
srvOPC.Disconnect
End Sub
I intend it to get a value, increment it by one, and write that new value to the server.
Can anyone offer any input as to why this fails when I try it on another machine? I'd be eternally grateful.
Thanks in advance.
Jeff
OK here's my problem: I need a VB6 application to read and write data to an OPC server. I can get my application to work locally, but when the app is distributed to another PC it fails.
First thing: DCOM settings good at both ends - I know this b/c I'm using Matrikon OPC browser with success to get to the node, find a server, and get an item.
Second thing: tried using many OPC Automation wrappers, including Kep and some others (I can't remember where I got them). All worked locally, none remotely.
Third thing: yes, the ProgID/CLSID is in both registries. I've gotten the Intellution OPCDATA.OCX working remotely but don't want to use it in the end because it limits me to one group and 50 items.
Fourth thing: I found the Kepware VB samples. The "complex" one was WAY more than I needed, and the "simple" also seemed far more complicated than necessary.
When I run my code on a remote machine I get the Error: Method '~' of Object '~' failed... message.
The only reference is to the Kepware OPC Automation 2.0. (Plus std VB and OLE stuff).
Here's the code block:
Dim WithEvents srvOPC As OPCServer
Private Sub Command1_Click()
Dim intClientHandle As Long
Dim RetVal
Set srvOPC = New OPCServer
srvOPC.Connect "Intellution.OPCiFIX.1", "GOBATTO"
srvOPC.OPCGroups.Add "Group1"
intClientHandle = srvOPC.OPCGroups(1).ClientHandle
srvOPC.OPCGroups(1).OPCItems.AddItem "Fix.WRITE_TEST.F_CV", intClientHandle
srvOPC.OPCGroups(1).OPCItems(1).Read OPCDevice
RetVal = srvOPC.OPCGroups(1).OPCItems(1).Value
MsgBox (">" & RetVal & "<")
RetVal = CInt(RetVal) + 1
srvOPC.OPCGroups(1).OPCItems(1).Write RetVal
RetVal = srvOPC.OPCGroups(1).OPCItems(1).Value
MsgBox (">" & RetVal & "<")
Set grpOPC = Nothing
srvOPC.OPCGroups.RemoveAll
srvOPC.Disconnect
End Sub
I intend it to get a value, increment it by one, and write that new value to the server.
Can anyone offer any input as to why this fails when I try it on another machine? I'd be eternally grateful.
Thanks in advance.
Jeff