BroadcastSystemMessageExA function (winuser.h)

Sends a message to the specified recipients. The recipients can be applications, installable drivers, network drivers, system-level device drivers, or any combination of these system components.

This function is similar to BroadcastSystemMessage except that this function can return more information from the recipients.

Syntax

long BroadcastSystemMessageExA(
  [in]                DWORD    flags,
  [in, out, optional] LPDWORD  lpInfo,
  [in]                UINT     Msg,
  [in]                WPARAM   wParam,
  [in]                LPARAM   lParam,
  [out, optional]     PBSMINFO pbsmInfo
);

Parameters

[in] flags

Type: DWORD

The broadcast option. This parameter can be one or more of the following values.

Value Meaning
BSF_ALLOWSFW
0x00000080
Enables the recipient to set the foreground window while processing the message.
BSF_FLUSHDISK
0x00000004
Flushes the disk after each recipient processes the message.
BSF_FORCEIFHUNG
0x00000020
Continues to broadcast the message, even if the time-out period elapses or one of the recipients is not responding.
BSF_IGNORECURRENTTASK
0x00000002
Does not send the message to windows that belong to the current task. This prevents an application from receiving its own message.
BSF_LUID
0x00000400
If BSF_LUID is set, the message is sent to the window that has the same LUID as specified in the luid member of the BSMINFO structure.

Windows 2000:  This flag is not supported.

BSF_NOHANG
0x00000008
Forces a nonresponsive application to time out. If one of the recipients times out, do not continue broadcasting the message.
BSF_NOTIMEOUTIFNOTHUNG
0x00000040
Waits for a response to the message, as long as the recipient is not being unresponsive. Does not time out.
BSF_POSTMESSAGE
0x00000010
Posts the message. Do not use in combination with BSF_QUERY.
BSF_RETURNHDESK
0x00000200
If access is denied and both this and BSF_QUERY are set, BSMINFO returns both the desktop handle and the window handle. If access is denied and only BSF_QUERY is set, only the window handle is returned by BSMINFO.

Windows 2000:  This flag is not supported.

BSF_QUERY
0x00000001
Sends the message to one recipient at a time, sending to a subsequent recipient only if the current recipient returns TRUE.
BSF_SENDNOTIFYMESSAGE
0x00000100
Sends the message using SendNotifyMessage function. Do not use in combination with BSF_QUERY.

[in, out, optional] lpInfo

Type: LPDWORD

A pointer to a variable that contains and receives information about the recipients of the message.

When the function returns, this variable receives a combination of these values identifying which recipients actually received the message.

If this parameter is NULL, the function broadcasts to all components.

This parameter can be one or more of the following values.

Value Meaning
BSM_ALLCOMPONENTS
0x00000000
Broadcast to all system components.
BSM_ALLDESKTOPS
0x00000010
Broadcast to all desktops. Requires the SE_TCB_NAME privilege.
BSM_APPLICATIONS
0x00000008
Broadcast to applications.

[in] Msg

Type: UINT

The message to be sent.

For lists of the system-provided messages, see System-Defined Messages.

[in] wParam

Type: WPARAM

Additional message-specific information.

[in] lParam

Type: LPARAM

Additional message-specific information.

[out, optional] pbsmInfo

Type: PBSMINFO

A pointer to a BSMINFO structure that contains additional information if the request is denied and dwFlags is set to BSF_QUERY.

Return value

Type: long

If the function succeeds, the return value is a positive value.

If the function is unable to broadcast the message, the return value is –1.

If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to the corresponding message, the return value is zero. To get extended error information, call GetLastError.

Remarks

If BSF_QUERY is not specified, the function sends the specified message to all requested recipients, ignoring values returned by those recipients.

If the caller's thread is on a desktop other than that of the window that denied the request, the caller must call SetThreadDesktop(hdesk) to query anything on that window. Also, the caller must call CloseDesktop on the returned hdesk handle.

The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other messages (those >= WM_USER) to another process, you must do custom marshalling.

Note

The winuser.h header defines BroadcastSystemMessageEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

BSMINFO

BroadcastSystemMessage

Conceptual

Messages and Message Queues

Reference

SendNotifyMessage