BroadcastSystemMessage (user32)
Last changed: -66.68.181.45

.
Summary

C# Signature:

[DllImport("user32", SetLastError=true)]
private static extern int BroadcastSystemMessage(MessageBroadcastFlags dwFlags, IntPtr lpdwRecipients, uint uiMessage, IntPtr wParam, IntPtr lParam);

[DllImport("user32", SetLastError=true)]
private static extern int BroadcastSystemMessage(MessageBroadcastFlags dwFlags, ref MessageBroadcastRecipients lpdwRecipients, uint uiMessage, IntPtr wParam, IntPtr lParam);

User-Defined Types:

[Flags]
enum MessageBroadcastFlags : uint
{     
    BSF_QUERY            = 0x00000001,
    BSF_IGNORECURRENTTASK       = 0x00000002,
    BSF_FLUSHDISK           = 0x00000004,
    BSF_NOHANG              = 0x00000008,
    BSF_POSTMESSAGE         = 0x00000010,
    BSF_FORCEIFHUNG         = 0x00000020,
    BSF_NOTIMEOUTIFNOTHUNG      = 0x00000040,
    BSF_ALLOWSFW            = 0x00000080,
    BSF_SENDNOTIFYMESSAGE       = 0x00000100,
    BSF_RETURNHDESK         = 0x00000200,
    BSF_LUID            = 0x00000400,
}

[Flags]
enum MessageBroadcastRecipients : uint
{
    BSM_ALLCOMPONENTS       = 0x00000000,
    BSM_VXDS        = 0x00000001,
    BSM_NETDRIVER       = 0x00000002,
    BSM_INSTALLABLEDRIVERS  = 0x00000004,
    BSM_APPLICATIONS    = 0x00000008,
    BSM_ALLDESKTOPS     = 0x00000010,
}

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

MessageBroadcastRecipients recipients = MessageBroadcastRecipients.BSM_APPLICATIONS;

BroadcastSystemMessageRecipients(
     MessageBroadcastFlags.BSF_IGNORECURRENTTASK, // do not send message to this process
     ref recipients,        // broadcast only to applications
     0x1,            // registered private message
     IntPtr.Zero,        // message-specific value
     IntPtr.Zero);        // message-specific value

Alternative Managed API:

Do you know one? Please contribute it!

Documentation