I'm trying to convert a *mut c_void to HWND (https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Foundation/struct.HWND.html) but it keeps throwing this error:
mismatched types
expected struct `HWND`
found raw pointer `*mut c_void`
How can I safely convert a *mut c_void to HWND (since HWND is built out of a c_void).
let hwnd = match parent.handle {
RawWindowHandle::Win32(_handle) => _handle.hwnd,
_ => panic!()
};
let mut test: windows::Win32::Foundation::HWND = hwnd;
I want an HWND from hwnd, but it throws this error:
mismatched types expected struct
HWND
found raw pointer*mut c_void
Thank you.
You can cast your pointer to isize and then construct HWND:
I'd just
transmute
though