Skip to main content

hwnd/um/winuser/flags/
ISMEX.rs

1//! \[[learn.microsoft.com](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-insendmessageex)\]
2//! InSendMessageEx return value flags
3
4#![allow(non_snake_case)]
5
6use crate::*;
7use bytemuck::*;
8use winapi::um::winuser::*;
9
10
11
12/// \[[learn.microsoft.com](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-insendmessageex)\]
13/// InSendMessageEx return value flags
14#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Zeroable)] #[repr(transparent)] pub struct InSendMessageExFlags(u32);
15impl_ops_for_flag!(InSendMessageExFlags);
16
17impl InSendMessageExFlags {
18    // Per <https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-insendmessageex#remarks>
19    pub fn is_sender_blocked(self) -> bool { self.0 & (ISMEX::REPLIED.0 | ISMEX::SEND.0) == ISMEX::SEND.0 }
20}
21
22impl From<InSendMessageExFlags> for u32 { fn from(cmd: InSendMessageExFlags) -> Self { cmd.0 } }
23impl From<u32> for InSendMessageExFlags { fn from(cmd: u32                 ) -> Self { Self(cmd) } }
24
25impl_debug_for_flags! {
26    InSendMessageExFlags => {
27        ISMEX::NOSEND,
28        ISMEX::CALLBACK,
29        ISMEX::NOTIFY,
30        ISMEX::REPLIED,
31        ISMEX::SEND,
32    }
33}
34
35
36
37pub const NOSEND    : InSendMessageExFlags = InSendMessageExFlags(ISMEX_NOSEND);
38
39/// The message was sent using the [send_message_callback](crate::send_message_callback_w) function. The thread that sent the message is not blocked.
40pub const CALLBACK  : InSendMessageExFlags = InSendMessageExFlags(ISMEX_CALLBACK);
41
42/// The message was sent using the [send_notify_message](crate::send_notify_message_w) function. The thread that sent the message is not blocked.
43pub const NOTIFY    : InSendMessageExFlags = InSendMessageExFlags(ISMEX_NOTIFY);
44
45/// The window procedure has processed the message. The thread that sent the message is no longer blocked.
46pub const REPLIED   : InSendMessageExFlags = InSendMessageExFlags(ISMEX_REPLIED);
47
48/// The message was sent using the [send_message](crate::send_message_w) or [send_message_timeout](crate::send_message_timeout_w) function.
49/// If [ISMEX::REPLIED] is not set, the thread that sent the message is blocked.
50pub const SEND      : InSendMessageExFlags = InSendMessageExFlags(ISMEX_SEND);