Looking at IStream, the declaration does not say anything about ISequentialStream and IUnknown. The stream object is unusable without ISequentialStream methods and I also need AddRef/Release from IUnknown, is there a workaround for this?
Scenario: I'm getting a pointer of IStream via IInitializeWithStream::Initialize, keep it, and read it in IThumbnailProvider::GetThumbnail. (Source currently with winapi-rs)
You can use .cast::<ISequentialStream>() which is from the windows::Interface trait that's implemented for IStream.
To use AddRef you call .clone() and Release is called once the interface is dropped (it implements the Drop trait).
I implemented COM inheritance support a short while back: https://github.com/microsoft/windows-rs/pull/448
I will publish another update to https://crates.io/ and update the documentation soon.
We should probably also add some docs to explicitly talk about how COM is handled. We have a two examples now using COM, but some prose that more directly explains things like QueryInterface == Interface::cast, AddRef == Clone::clone, and Release == Drop would be good to have.
crates.io and the Windows API documentation has now been updated. For example, you can find the IStream docs here. As you can see, it provides the ISequentialStream methods directly (as they're inherited) and provides convertibility for all base interfaces.
Cool, confirmed that ISequentialStream::Read works 馃憤
Hmm, actually reopening for https://github.com/microsoft/windows-rs/issues/512#issuecomment-773461506
Glad to hear its working. 馃榾
Duplicate of #81
Most helpful comment
We should probably also add some docs to explicitly talk about how COM is handled. We have a two examples now using COM, but some prose that more directly explains things like
QueryInterface==Interface::cast,AddRef==Clone::clone, andRelease==Dropwould be good to have.