-
Beta Was this translation helpful? Give feedback.
Answered by
tronical
May 29, 2024
Replies: 2 comments 2 replies
-
You’re almost there :). |
Beta Was this translation helpful? Give feedback.
2 replies
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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;