winapi-rs icon indicating copy to clipboard operation
winapi-rs copied to clipboard

COMpatibility

Open hadeutscher opened this issue 4 years ago • 2 comments

This PR aims to provide the ability to use interfaces defined in this crate with Microsoft's com crate.

This, along with my PR in com-rs and some glue code that ties everything together, allows us to do some cool stuff, such as produce COM classes that implement interfaces from the Windows API, e.g.

use winapi::um::strmif::IFilterMapper2;

// a2c3c6ea-a415-4809-a55c-b49934d81ab7
DEFINE_GUID!(CLSID_MY_CLASS, 0xa2c3c6ea, 0xa415, 0x4809, 0xa5, 0x5c, 0xb4, 0x99, 0x34, 0xd8, 0x1a, 0xb7);

com::class! {
    pub class MyClass: ComPtr<IFilterMapper2> {
        a: i32,
    }

    impl ComPtr<IFilterMapper2> for MyClass {
        fn EnumMatchingFilters(&self) -> HRESULT { E_NOINTERFACE }
    }
}

com::inproc_dll_module![(CLSID_MY_CLASS, MyClass),];

hadeutscher avatar Jan 23 '21 15:01 hadeutscher

CI throws error: associated constants are experimental ; probably Rust version there is very old

@retep998 ?

hadeutscher avatar Jan 23 '21 19:01 hadeutscher

I upgraded the CI Rust to 1.25, should solve it in the mean while

hadeutscher avatar Jan 23 '21 19:01 hadeutscher