I'm fairly new to Rust and am trying to get the following to work:
let hwnd : *mut HWND = window.hwnd().cast();
let swapchain = unsafe { factory.CreateSwapChainForHwnd(&device, *hwnd, &desc, std::ptr::null(), &output)? } ;
where window.hwnd()
returns a *mut c_void
and I need to cast that to a windows::Windows::Win32::Foundation::HWND
, but this example crashes on a access violation. I assume its because I deref a pointer to a HWND
whereas the HWND
itself should be the void ptr. HWND
can be created from an isize
, so like HWND(isize)
but I'm not sure if that should get the address of the void pointer or something? Any help is appreciated.