Microsoft COM in c#
Hi
Iam new to this COM.
I need to convert a string to VT_BSTR.
One method is I have my string in c# and i need to pass this as parameter in c++ application where i need to convert it into VT_bstr and return the result in c#.How to do this and where i wil hold the VT_bstr variable in c#.
Another method is how to convert string to VT_bstr in c# itself.
Please help me on this.
Sam HobbsPosted Nov 5, 2010, 7:31 PM
VT_BSTR is not a type; it is a code that indicates that a variant object has a bstr in it. A bstr is always created by Windows, but I think that all striings in C# are like bstrs.
So you need to check the documentation for use of the variant type in C#; that is, how to tell C# that a parameter is a variant.
If the C# truly is a COM object, then you don't need to be concerned about details; just add a reference to the COM object and let C# take care of details. Are you sure it is a COM object?
Achal KumarPosted Jan 18, 2016, 2:37 AM
Zbynek ZahradnikPosted Mar 24, 2014, 5:00 AM
You may want save yourself a lot of trouble by using an OPC client toolkit instead, something like : http://www.opclabs.com/products/quickopc/languages-and-tools/csharp
Sam HobbsPosted Nov 12, 2010, 4:30 AM
manju MPosted Nov 12, 2010, 2:10 AM
Thanks for your reply.
My requirement is i need to fetch value from database and to write the value in AIM OPC server.
The OPC server supports variant type only.
I need to convert the value which is in string in database to variant.
when i referred some dcoument for AIM OPC server, it s given that the equivalent of string is vt_bstr. so i need to convert this into that.
Wat reference i need to add or how to do this?