-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You’re almost there :). |
Beta Was this translation helpful? Give feedback.
-
for future readers: let ui = MainWindow::new()?;
let slint_wh = ui.window().window_handle();
let maybe_raw_window_handle = slint_wh.window_handle(); // Result<WindowHandle, HandleError>
let mut raw_hwnd = NonZeroIsize::new(-1).unwrap();
match maybe_raw_window_handle {
Ok(win_handle) => {
match win_handle.as_ref() {
raw_window_handle::RawWindowHandle::Win32(handle) => {
raw_hwnd = handle.hwnd;
},
_ => {
// ...
}
}
},
Err(e) => {
// ...
}
} |
Beta Was this translation helpful? Give feedback.
-
I'm having trouble with the import of this into my project. my toml
and i get the error on the import:
|
Beta Was this translation helpful? Give feedback.
in order to be able to call raw-window-handle’s window_handle function (https://docs.rs/raw-window-handle/latest/raw_window_handle/trait.HasWindowHandle.html#tymethod.window_handle ) on a slint::WindowHandle, you need to bring the HasWindowHandle trait (https://docs.rs/raw-window-handle/latest/raw_window_handle/trait.HasWindowHandle.html# ) in scope. Add raw-window-handle in version 0.6 to your Cargo.toml and add
use raw_window_handle::HasWindowHandle;