I don't have any version of nids.dll on any 3 of my machines including the one on which the OPC Client example works. I've seen reference to it a few places but couldn't find anywhere to download it. I'm guessing that it did not come with ComponentWorks 2.0.1? Was there an equivlent .dll that came with that version that I could look for?
In my code, as far as I can tell the problem occurs in a call to ConnectTo which is in cwdatasocket.h:
void CCWDataSocket::ConnectTo(LPCTSTR URL, long AccessMode)
{
static BYTE parms[] = VTS_BSTR VTS_I4;
InvokeHelper(0xd, DISPATCH_METHOD, VT_EMPTY, NULL, parms, URL, AccessMode);
}
and my code looks like this (i've cut some irrelevent parts...):
bool CCurrentLoop::InitializeDSockets()
{
BSTR b
strLic;
BOOL cRFail, cWFail;
VARIANT vt;
vt.vt = VT_R4;
vt.fltVal = 0.004f;
pWs = new CCWDataSocket[mNumOutputs];
pRs = new CCWDataSocket[mNumOutputs];
bstrLic = ::SysAllocStringLen(pwchcwdsLic1, sizeof (pwchcwdsLic1) / sizeof(WCHAR));
CString lic1 = pLic1;
for (int i = 0; i < mNumOutputs; i++)
{
cWFail = pWs[i].Create("", WS_DISABLED, CRect(0,0,100,100), pWnd, DSID[i], NULL, FALSE, bstrLic);
cRFail = pRs[i].Create("", WS_DISABLED, CRect(0,0,100,100), pWnd, DSRID[i], NULL, FALSE, bstrLic);
if ((cWFail == FALSE) || (cRFail == FALSE))
{
AfxMessageBox("No Data Socket Created");
return(FALSE);
}
CCWData data(pWs[i].GetData());
data.SetValue(vt);
pWs[i].ConnectTo(pDSRec[i].url, cwdsWriteAutoUpdate); ** Error occurs here!!
pRs[i].ConnectTo(pDSRec[i].url, cwdsReadAutoUpdate);
}
.
.
.
Thanks much!
Eric