Find some OPC client and server demos on the Internet.
Write the OPC client to implement an OPC explorer.
First, you need to know the guid of those standard OPC interfaces. 1. You can download an OPC Core Components SDK from the OPC Foundation. msi, installation, after installation, although there is a "OPC foundationobject directory, but only a few documents, dllall is thrown to system32, such as opcenu,.exe, opcproxy. DLL, and then use Delphi's "Import Type Library... "function is imported into a * _ TLB. PAS. 2. Take the interface units organized by others directly.
How to list the OPC server installed on the local machine, one is to read the registry, and the other is to use opcenum.exe in OPC Core Components sdk.msi.
OPC calls the document item. The structure of the item includes a tree structure and a non-tree structure. You can view the structure implemented by OPC server through queryorganization of the iopcbrowseserveraddressspace interface. If it is opc_ns_hierarchial, the tree has branches, such as branch and leaf.
Item can be added to the group, then the group and item can be activated, and a callback interface is provided. The OPC server checks whether the data changes according to the scanrate set by your group, and sends the data if the data changes.
Test shows that different OPC servers implement different levels and degrees. Generally, OPC Explorer can only add leaf to a group, but does not support adding branch to a group, most OPC servers follow this principle, but some OPC servers are innovative. For example, if a Keba controller is used as a function, branch writes any value to branch, it is equivalent to calling a function, and then there are in and out sub-branch under this branch, then the leaf under out can read the value returned by the function. A little creative; otherwise, the general practice is to use custom interfaces, but in this way, OPC Explorer cannot automatically discover these interfaces and functions based on OPC rules.