R., K.,
I have managed to create a C++ example with ReadMultipleItems and DAVtqResult at this last moment.
Here is a code that works (tested with QuickOPC-COM 5.10):
#include "stdafx.h"
#include
#include
#import "libid:FAB7A1E3-3B79-4292-9C3A-DF39A6F65EC1" version(5.1) // EasyOpcLib
using namespace EasyOpcLib;
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize the COM library
CoInitialize(NULL);
// Instatiate the EasyOPC-DA client object
IEasyDAClientPtr EasyDAClientPtr(__uuidof(EasyDAClient));
CComSafeArray 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 ResultArray(vResults.parray);
for (int i = ResultArray.GetLowerBound(0); i < ResultArray.GetUpperBound(0); i++)
{
IDAVtqResultPtr DAVtqResultPtr(ResultArray);
IDAVtqPtr DAVtqPtr(DAVtqResultPtr->Vtq);
_tprintf(_T("results(%d).Vtq.ToString(): %s\n"), i, DAVtqPtr->ToString().bstrVal);
}
// Release all interface pointers BEFORE calling CoUninitialize()
ResultArray.Destroy();
vResults.Clear();
EasyDAClientPtr = NULL;
CoUninitialize();
TCHAR line[80];
_putts(_T("Press Enter to continue..."));
_fgetts(line, sizeof(line), stdin);
return 0;
}
I am attaching a zipped project, too (in VS 2010).
If the customer is using managed C++ with QuickOPC.NET, the code would be quite different, though; in such case, let me know again.
Best regards,