See the question and my original answer on StackOverflow

What you can do is use a Type Library.

If you have one, that's one thing you won't have to do. If you don't have one, then you can create one using the MIDL compiler. That's a free tool that comes with the Platform SDK. Of course in this case, it will mean you will have to write an IDL file (which can be a lot of work but you only need to define what you want). Depending on the kind of COM object you're targeting, an IDL file may already be available in the SDK. Once you have that IDL ready, you can compile it and get back a TLB file.

Once you have that TLB file, you can load it using the LoadTypeLib function. Once you have an ITypeLib reference, you can load the ITypeInfo that you need (there may be more than once), and basically route IDispatch calls (GetIDsOfNames, etc.) into ITypeInfo implementation calls, as they are very similar.