CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2005
    Posts
    126

    Post C# as a COM Client

    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?
    Last edited by definition; October 10th, 2005 at 10:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured