BroadcastSystemMessageW 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.
To receive additional information if the request is defined, use the BroadcastSystemMessageEx function.
Syntax
long BroadcastSystemMessageW(
[in] DWORD flags,
[in, out, optional] LPDWORD lpInfo,
[in] UINT Msg,
[in] WPARAM wParam,
[in] LPARAM lParam
);
Parameters
[in] flags
Type: DWORD
The broadcast option. This parameter can be one or more of the following values.
Value | Meaning |
---|---|
|
Enables the recipient to set the foreground window while processing the message. |
|
Flushes the disk after each recipient processes the message. |
|
Continues to broadcast the message, even if the time-out period elapses or one of the recipients is not responding. |
|
Does not send the message to windows that belong to the current task. This prevents an application from receiving its own message. |
|
Forces a nonresponsive application to time out. If one of the recipients times out, do not continue broadcasting the message. |
|
Waits for a response to the message, as long as the recipient is not being unresponsive. Does not time out. |
|
Posts the message. Do not use in combination with BSF_QUERY. |
|
Sends the message to one recipient at a time, sending to a subsequent recipient only if the current recipient returns TRUE. |
|
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 |
---|---|
|
Broadcast to all system components. |
|
Broadcast to all desktops. Requires the SE_TCB_NAME privilege. |
|
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.
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.
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.
Examples
For an example, see Terminating a Process.
Note
The winuser.h header defines BroadcastSystemMessage as an alias that 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 is 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 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
See also
Conceptual
Reference