Re: Determing Interface type
The supplied code takes the I/P and asks whether it supports IStorage and then IStream. This will work fine as long as the object implementing the interface that you passed does not support both interfaces.
I think the only problem you'll get with passing it as a long is if you intend marshaling it across processes.
The way that many of the COM functions resolve this is to pass an additional parameter (i.e. the IID of the interface) see both QueryInterface and CoCreateInstance for examples.
Re: Determing Interface type
Thank you for your help.
An additional question:
I am using these objects in-process. If I wanted to use them cross-process, won't a long end up marshalling (assuming universal marshaller) as just a long and not really be an interface to my object? Would an IUnknown* work better?
Re: Determing Interface type
Absolutely, you have to pass across an interface pointer for cross process/machine calls.