Professional OPC Development Tools and Services

opc logo

OPC development in C and C++

QuickOPC will make it easy for you to integrate OPC client functionality into your solution developed in C or C++ language. Reading a value from OPC Data Access or OPC UA server, or writing a data value can be achieved in just a few lines of C or C++ code. You can also set up subscriptions and receive event notifications about data changes. OPC Alarms&Events specification is also supported. Programming to the raw OPC interfaces can be complex in C/C++, but our component interfaces hide the complexities of OPC from the developer.

You can create OPC C or OPC C++ programs in various environments: ATL, MFC, console applications, and Windows services are all supported. The development tool we have targeted primarily is Visual Studio 2012, 2013 and 2015; older versions of Microsoft Visual C/C++ should work well, too.

Note: For managed C++ (C++/CLR), see QuickOPC.NET.

  • New: QuickOPC can now connect to OPC UA (Universal Architecture) servers.

QuickOPC Price List

Read More

Simple QuickOPC Example in C++

The code below (in C++) reads 4 OPC items at once, and displays their values, timestamps and qualities, using QuickOPC-COM:

CComSafeArray<BSTR> ItemIdArray(4);
ItemIdArray[0] = _T("Simulation.Random");
ItemIdArray[1] = _T("Trends.Ramp (1 min)");
ItemIdArray[2] = _T("Trends.Sine (1 min)");
ItemIdArray[3] = _T("Simulation.Register_I4");
CComVariant vMissing;
vMissing.vt = VT_ERROR;
CComVariant vResults(EasyDAClientPtr->ReadMultipleItems(_T(""), _T("OPCLabs.KitServer.2"), 
    CComVariant(ItemIdArray.Detach()), vMissing));
CComSafeArray<VARIANT> ResultArray(vResults.parray);
for (int i = ResultArray.GetLowerBound(0); i < ResultArray.GetUpperBound(0); i++)
    IDAVtqResultPtr DAVtqResultPtr(ResultArray[i]);
    IDAVtqPtr DAVtqPtr(DAVtqResultPtr->Vtq);
    _tprintf(_T("results(%d).Vtq.ToString(): %s\n"), i, DAVtqPtr->ToString().bstrVal);

And, a code to read a value of a node from an OPC Unified Architecture (OPC UA) server, using QuickOPC-UA for COM:

    // Instatiate the client object
    _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));
    // Perform the operation
    _variant_t value = ClientPtr->ReadValue(
    // Display results
    _variant_t vString;
    vString.ChangeType(VT_BSTR, &value);
    _tprintf(_T("value: %s\n"), CW2T((_bstr_t)vString));

More C examples are included with the product.