#[repr(C)]pub struct Msg {
pub hwnd: HWnd,
pub message: WM32,
pub wparam: WPARAM,
pub lparam: LPARAM,
pub time: u32,
pub pt: Point,
}Expand description
[learn.microsoft.com] MSG
Contains message information from a thread’s message queue.
Fields§
§hwnd: HWnd§message: WM32§wparam: WPARAM§lparam: LPARAM§time: u32§pt: PointImplementations§
Source§impl Msg
impl Msg
pub fn default() -> Self
Sourcepub fn zeroed() -> Self
pub fn zeroed() -> Self
Examples found in repository?
examples/hello-world.rs (line 64)
25fn main_imp() -> i32 {
26 let hinstance = get_module_handle_entry_exe().unwrap();
27 let hcursor = load_cursor_w(None, IDC::ARROW).unwrap();
28 let hicon = load_icon_w(None, IDI::APPLICATION).unwrap();
29
30 let wc = WndClassW {
31 wnd_proc: Some(window_proc),
32 hinstance,
33 hcursor,
34 hicon,
35 class_name: cstr16!("SampleWndClass").into(),
36 .. WndClassW::zeroed()
37 };
38 let wc = unsafe { register_class_w(&wc) }.unwrap();
39
40 let ex_style = 0;
41 let style = WS::OVERLAPPEDWINDOW;
42 let size = adjust_window_rect_ex_copy(
43 Rect { left: 0, right: 800, top: 0, bottom: 600 },
44 style, false, ex_style
45 ).unwrap();
46
47 let hwnd = unsafe { create_window_ex_w(
48 ex_style,
49 wc,
50 cstr16!("hello-world"),
51 style,
52 CW_USEDEFAULT,
53 CW_USEDEFAULT,
54 size.right - size.left,
55 size.bottom - size.top,
56 null_mut(),
57 null_mut(),
58 hinstance,
59 null_mut(),
60 )}.unwrap();
61
62 show_window_async(hwnd, SW::SHOWNORMAL).unwrap();
63
64 let mut msg = Msg::zeroed();
65 while get_message_w(&mut msg, HWnd::NULL, 0, 0).unwrap() {
66 translate_message(&msg);
67 let _ = unsafe { dispatch_message_w(&msg) };
68 }
69
70 if msg.message == WM::QUIT { return msg.wparam as _ }
71 0 // assume success of we ever `break` out of our message loop instead of `return !0`ing
72}Trait Implementations§
impl Copy for Msg
impl Eq for Msg
Source§impl Ord for Msg
impl Ord for Msg
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Msg
impl PartialOrd for Msg
impl StructuralPartialEq for Msg
Auto Trait Implementations§
impl Freeze for Msg
impl RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl UnsafeUnpin for Msg
impl UnwindSafe for Msg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more