0

I have a legacy COM component which I need wrap and use in .NET code. When I used the tlbimp to create the RCW for the component just one interface had a coclass created to which I was able to make a call. Rest five or so interface does not have a coclass. If I look up in ildasm on the interop there are just interfaces without coclass.

How do I make this work to be able to call all methods on the component. Is there a way I can add coclass code myself in and expect the implementation to work.

Rytis I
  • 1,105
  • 8
  • 19
Pacchy
  • 73
  • 11
  • This is quite normal, a coclass typically implements more than one interface. Just like the List class implements IList and ICollection and IEnumerable etc. It just takes a simple cast in C# to obtain a reference to the other interfaces. Like `var itf2 = (ISomeOtherInterface)obj;` Or it might be returned by one of the methods. – Hans Passant Apr 25 '14 at 16:03
  • @Hans Thanks. You mean one of the coclasses might have the implementation. I did try casting existing coclass which fails with an error on casting. – Pacchy Apr 28 '14 at 06:49

0 Answers0