windows_helpers/
wnds_and_msging.rs

1#![cfg(feature = "f_Win32_UI_WindowsAndMessaging")]
2
3use crate::windows;
4use std::mem;
5use windows::Win32::{Foundation::LPARAM, UI::WindowsAndMessaging::TIMERPROC};
6
7pub trait TimerProcExt {
8    /// It's yet to be confirmed that the transmute works. Create an issue if it works or doesn't.
9    unsafe fn from_lparam(lparam: LPARAM) -> Self;
10}
11
12impl TimerProcExt for TIMERPROC {
13    unsafe fn from_lparam(lparam: LPARAM) -> Self {
14        if lparam.0 != 0 {
15            Some(mem::transmute(lparam.0))
16        } else {
17            None
18        }
19    }
20}