C++ MountChannelEx

Britton Leslie

Posted on 17.01.2018 16:30

I am having an issue using the MountChannelEx function. It is setting the IChannel Value as Null and therefore causing a error when using any of the IChannel set commands, such as SetAsync. The MountChannel function works, however is marked as depreciated. Below is my example code. My though at this point is that maybe I am doing the index variant array wrong? Any suggestions or examples would be good. The tutorial from the DCOM manual uses MountChannel and not MountChannelEx. I am using Visual Studio 2013, C++, and have had the same results on X2 SP10 and X3.

VARIANT indArray;

indArray.vt = VT_ARRAY | VT_R4;

SAFEARRAYBOUND rgsabound[1];

rgsabound[0].lLbound = 0;

rgsabound[0].cElements = 1;

long channelIndex = 0;

indArray.parray = SafeArrayCreate(VT_R4, 1, rgsabound);

float dataIn = 33;

SafeArrayPutElement(indArray.parray, &channelIndex, (void*)&dataIn);


OLECHAR* tmp;

StringFromCLSID(CLSID_VCppPluginImpl, &tmp);

BSTR bstrGuid = SysAllocString(tmp);

pluginGroup->MountChannelEx(tmp, 1, indArray, &ch2);

CoTaskMemFree(tmp);

SysFreeString(bstrGuid);


_bstr_t s2 = "Channel Value Scaled";

ch2->SetAsync(TRUE);

ch2->SetDataType(5);

ch2->put_Used(TRUE);

ch2->put_Name(s2);




Britton Leslie

Posted on 17.01.2018 18:05

I found my issue. I was passing in the wrong variable for the plugin GUID.

Changed pluginGroup->MountChannelEx(tmp, 1, indArray, &ch2); to pluginGroup->MountChannelEx(bstrGuid, 1, indArray, &ch2);


However now I am seeing an issue where my data changes after the buffer fills and wraps. I will need to trouble shoot this now, any suggestions are welcome.


Attached files:
DEWESoft Support
Technical support
Posted on 18.01.2018 09:06

Hi,

I was just about to write back about the mounting issue, but it seems you have that all figured out. Could you perhaps explain what your new issue is in a bit more detail?

Since you're talking about buffers wrapping around, I'm guessing that you're having trouble with reading data. Is that correct? If so, these two general guidelines could be useful in your development:

The buffer structure: https://www.dewesoft.com/assets/dcom/dws7_dc_the_b...

How to read data: https://www.dewesoft.com/assets/dcom/dws7_dc_how_t...

Login to reply to this topic. If you don't have account yet, you can signup for free account .