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?
from oleView, i see this for ICustomerRetList
[
odl,
uuid(DF331154-953C-4813-BAEC-F65DDBBFEB5B),
helpstring("ICustomerTypeRetList Interface"),
dual,
oleautomation
]
interface ICustomerTypeRetList : IQBBase {
[id(0x00000004), helpstring("method GetAt")]
HRESULT GetAt(
long index,
[out, retval] ICustomerTypeRet** retVal);
[id(0x00000005), propget, helpstring("property Count")]
HRESULT Count([out, retval] long* pVal);
[id(0x00000006), helpstring("method Append")]
HRESULT Append([out, retval] ICustomerTypeRet** retVal);
};
some more relevant lines from the typeLib
there are 36 interface declarations. I think we have established we are not after these... we want the things that implement these
interface ICustomerMsgRetList;
interface ICustomerMod;
there are many lines that reference types such as the line below. These are simply objects that have customer as a property (Purchase order for instance). These are all found w/in Interface declarations. Its been a while since I did C++. Is IQBBase a pointer to a pointer? Thinking outloud, dont need an answer.
HRESULT CustomerRef([out, retval] IQBBaseRef** pVal);
So yes, there may be a factory in there somewhere. I do believe these object (ICustomerRetList implementers) are instantiable, they clearly are instantiated. But the typelib is not giving up its secrets. Going back to the original question, I don't think there is an answer unless I can get the progId. The progIds may be purposefully obfuscated. Dont know. I know I guess at them and have not been successful. The intuit support forum is no longer active to the best of my knowledge.