OPC Programming with C++Builder
A number of Delphi OPC solutions also support C++Builder. Visit our Delphi page for more information on dOPC and Prosys Sentrol.
The code samples on this page have been generously provided by Rusman Rusyadi. Thanks Rusman! Most were developed with C++Builder 4, though the first sample, Using the OPC Custom Interfaces Directly, is updated for C++Builder 6.
The downloads on this page are hosted by the opcdelphi project on Google Code. |
- Using the OPC Custom Interfaces Directly
- Using ActiveX Control from Softing
- Using WinTECH Client Toolkit
- Using WinTECH Client Toolkit - Alarms & Events Client
Building an OPC Client
Using the OPC Custom Interfaces Directly
This is certainly the most flexible approach, and may consequently require more coding than the alternatives discussed below.
This sample was originally published by Ionel Munoz via the CodeCentral site. It has been extended here to include:
- server browser for selecting the required OPC server
- item browser for selecting an item to be displayed
More recently, Ionel Munoz also contributed to the update for C++Builder 6.
Download the ZIP file for C++Builder 6.
Using ActiveX Control from Softing
Making use of an ActiveX control minimizes the amount of coding required, but also offers the least flexibility.
The sample code shows how to use Softing's SOAXC ActiveX control. SOAXC is a component of Softing's OPC Toolbox ActiveX.
Using WinTECH Client Toolkit
This approach offers a good compromise between flexibility and coding efficiency. The client programmer has no need to understand low-level COM programming, as the DLL totally encapsulates this functionality.
The first sample client allows you to connect to a local or remote server, create one or more groups using various update rates, and scan data items for display. You may also write values back to the server.
The second demo client utilizes some of the advanced features of the WinTECH toolkit. The browsing operation of this client is more refined, presenting item names in the hierarchical format.
Using WinTECH Client Toolkit - Alarms & Events Client
This demo is a simple Alarms & Events client that demonstrates the basic API of the WinTECH Client Toolkit.
Building an OPC Server
Using WinTECH Server Toolkit
This demo is a simple OPC Server application that demonstrates the basic API of the WinTECH Server Toolkit. It is compatible with OPC 1.0 and 2.0 clients.
Using MatrikonOPC's Server Toolkit
OPC Genie (Generic Information Exchange) enables the exchange of process data between OPC compliant applications and any device that supports serial or Ethernet communication. This flexibility enables you to develop an OPC server without sacrificing throughput or data integrity. Simply configure OPC Genie with the required protocol and all the data will be exposed via OPC!
OPC Utilities
Techniques for Listing OPC Servers
This sample shows how to obtain a listing of OPC servers from a local or remote machine using three different techniques:
- search through Windows Registry directly (as used in SST's client sample)
- search raw list via COM interface
- search with the help of OPCENUM