The Variant FOPCServer;
FOPCServer=new TOPCServer (Application);
Under the normal should be operated on FOPCServer new variables, such as FOPCServer. The Connect (); (consider can connect)
But when compile errors [BCC32 Error] Unit7. CPP (28) : E2316 'Connect' is not a member of 'the Variant, but FOPCServer should now be TOPCServer this type, this type is the Connect () this function!
Consult everybody warrior!
With Delphi in a
Statement of OPC class and interface
FOPCServer: TOPCServer;
FOPCGroup: TOPCGroup;
FOPCb: OPCBrowser;
FOPCItems: OPCItems;//interface
FOPCItem: OPCItem;//interface
//access OPC Server list
The function TForm1. OPCServerList () : a Boolean;
Var OPCServerList OPCServerName: OleVariant;
J, I: integer;
The begin
Result:=false;
Try
FOPCServer:=TOPCServer. Create (Self);
OPCServerList:=FOPCServer. GetOPCServers; is equivalent to the red this passage compile wrong
CodePudding user response:
Lu onlookers, don't understand opc, good good study, day day upCodePudding user response:
Are you using Delphi and c + + builderCb,
FOPCServer=new TOPCServer ();
OPCServerList=FOPCServer - & gt; GetOPCServers;
You see TOPCServer class definition, in an HPP file, look have GetOPCServers method, if not they may not call success.
GetOPCServers in another class, you search for import HPP generated file
CodePudding user response:
Internet has a lot of this kind of program, the original poster can search under referenceCodePudding user response:
OLE in the c + + Builder than some trouble in the Delphi,OPCServerList:=FOPCServer. GetOPCServers;
Translate:
OPCServerList=FOPCServer. OleFunction (" GetOPCServers ");
FOPCServer. The Connect ();
Also must be written:
FOPCServer. OleFunction (" Connect ");