Click to See Complete Forum and Search --> : C# as a COM Client


definition
October 10th, 2005, 10:47 AM
hey, I'm trying to understand how to get c# to handle a COM components, I'm having trouble understanding how the c# object key word relates to VARIANTS.

for example the follow code causes an exception to be thrown before it even enter the method its calling within the com object, hence i believe a type mismatch in the parameters somehow.

try
{
object data = "2";
myconnection.write(ref data);
}
catch (COMException exception)
{
hResult = (uint)exception.ErrorCode;
Console.Write("mooooo");
Console.Write(hResult.ToString());
}

this is the method it calls:
STDMETHODIMP CConnection::write(VARIANT *write)

can anyone point me in the direction of some material on this subject or give me an example of what i should have done, please?