mercredi 20 avril 2016

Invoke a COM Method using InvokeMember

I am wrapping a COM API Ultimately I am trying to push more code down into Generics and the inheritance pattern in the api is not helping.

I have a generic of IBase, THere are ~80 classes that represent result sets. They are very similar, but they all inherit, or rather implement, the very basic IBase.

I have tried Extension methods and I dont think that is the way to go because the com is late bound and using Reflection.PropertyInfo seemed to be a dead end.

In the generic, we have the sub types, so I think I can use InvokeMember to call the methods/properties I need.

instnc = Activator.CreateComInstanceFrom(assy, tyepname)
retClass = Type.GetTypeFromProgID(progId)

My challenge is that I can not find the progId. I have searched the registry, I have made many guesses. "Excel.Application" works, so the basic approach is solid.

THe com dll in question is the Intuit Quickbooks api. I have tried many variations of

"QBFC13Lib.ICustomerRetList"

Am I on the right track? If so, where can I find the progId? Should I try a different tack?





Aucun commentaire:

Enregistrer un commentaire