microsoft / windows-rs

Rust for Windows
https://kennykerr.ca/rust-getting-started/
Apache License 2.0
10.23k stars 475 forks source link

Failed to implement COM interface in v0.56 #3038

Closed leexgone closed 3 months ago

leexgone commented 3 months ago

Summary

error[E0433]: failed to resolve: could not find windows_core in the list of imported crates --> tests\event_test\src\lib.rs:4:1 4 #[implement(IUIAutomationEventHandler)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find windows_core in the list of imported crates

= note: this error originates in the attribute macro implement (in Nightly builds, run with -Z macro-backtrace for more info)

Crate manifest

[package]
name = "event_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.windows]
version = "0.56.0"
features = [
    "implement",
    "UI_UIAutomation",
    "Win32_UI_Accessibility",
]

Crate code

use windows::core::*;
use windows::Win32::UI::Accessibility::*;

#[implement(IUIAutomationEventHandler)]
pub struct MyEventHandler {
}

impl IUIAutomationEventHandler_Impl for MyEventHandler {
    fn HandleAutomationEvent(&self,sender:Option<&IUIAutomationElement>,eventid:UIA_EVENT_ID) -> windows::core::Result<()> {
        todo!()
    }
}
kennykerr commented 3 months ago

See #2917