Atiz
2008-01-22 10:47:25 UTC
Hi, I have an OPC client.
I used a server to send value to the OPC client whereby it detects the
value.
The OPC client is able to detect the value as a VT_BSTR.
The function which detects the value as a VT_BSTR has VARIANT* pValue
as a parameter.
When this pValue is a VT_BSTR type, I have trouble extracting the
correct value out.
Currently my method does this:
BSTR bstr = V_BSTR(pValue);
int a = SysStringLen(bstr)+1;
char *ansistr = new char[a];
result = ::WideCharToMultiBYte(CP_ACP, 0, bstr, -1, ansistr, a, NULL,
NULL);
I tried to print out
LOG4CPLUS_DEBUG(logPacket, *V_BSTR(pValue));
LOG4CPLUS_DEBUG(logPacket, bstr);
but the value is always different and is not the value that is sent
over to the OPC client.
How can I get the correct value out from pValue?
TIA,
Atiz
I used a server to send value to the OPC client whereby it detects the
value.
The OPC client is able to detect the value as a VT_BSTR.
The function which detects the value as a VT_BSTR has VARIANT* pValue
as a parameter.
When this pValue is a VT_BSTR type, I have trouble extracting the
correct value out.
Currently my method does this:
BSTR bstr = V_BSTR(pValue);
int a = SysStringLen(bstr)+1;
char *ansistr = new char[a];
result = ::WideCharToMultiBYte(CP_ACP, 0, bstr, -1, ansistr, a, NULL,
NULL);
I tried to print out
LOG4CPLUS_DEBUG(logPacket, *V_BSTR(pValue));
LOG4CPLUS_DEBUG(logPacket, bstr);
but the value is always different and is not the value that is sent
over to the OPC client.
How can I get the correct value out from pValue?
TIA,
Atiz