Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
After connecting with opc server, i m trying to directly use the defined function Readvariable() below to read server data to client side. Anyone know how to achieve this? Especially how to define the State pointer?


C++
long COPCData::ReadVariable(LPCTSTR VariableName, VARIANT* Value, long* State, long TimeOut)
{
	long result;
	static BYTE parms[] =
		VTS_BSTR VTS_PVARIANT VTS_PI4 VTS_I4;
	InvokeHelper(0x10, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
		VariableName, Value, State, TimeOut);
	return result;
}



C++
long COPCData::WriteVariable(LPCTSTR VariableName, const VARIANT& Value, long TimeOut)
{
	long result;
	static BYTE parms[] =
		VTS_BSTR VTS_VARIANT VTS_I4;
	InvokeHelper(0x11, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
		VariableName, &Value, TimeOut);
	return result;
}
Posted
Updated 21-Aug-11 23:08pm
v2
Comments
Sergey Chepurin 22-Aug-11 5:58am    
Are you aware of OPC Foundation Forum: http://opcfoundation.org/forum/ ?
Even though i wrote an OPC Client in C/C++ this particular implementation of Read/Write variable functions tells me nothing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900