ComponentDispatcher ComponentDispatcher ComponentDispatcher ComponentDispatcher Class


Enables shared control of the message pump between Win32 and WPF in interoperation scenarios.

public ref class ComponentDispatcher abstract sealed
public static class ComponentDispatcher
type ComponentDispatcher = class
Public Class ComponentDispatcher


Although the class itself is static, all members of ComponentDispatcher are specific to a particular thread. For example, if you examine the value of IsThreadModal on two different threads, you might get different values.

The methods are static but they are backed by per-thread data structures. The static methods allow singleton access but the ComponentDispatcher is sorting out the appropriate per-thread operations.

The owner of the message pump is defined by the code that calls the Win32 function GetMessage. The owner calls RaiseThreadMessage for every keyboard message. This method raises the ThreadFilterMessage event with the messages contained in the event data. If that event is not handled, the owner raises the ThreadPreprocessMessage event with the messages contained in the event argument.


Only keyboard messages are supported.


CurrentKeyboardMessage CurrentKeyboardMessage CurrentKeyboardMessage CurrentKeyboardMessage

Gets the last message that was raised.

IsThreadModal IsThreadModal IsThreadModal IsThreadModal

Gets a value that indicates whether the thread is modal.


PopModal() PopModal() PopModal() PopModal()

Called to indicate that a modal thread is no longer modal.

PushModal() PushModal() PushModal() PushModal()

Called to indicate that the thread is modal.

RaiseIdle() RaiseIdle() RaiseIdle() RaiseIdle()

Called to indicate that a thread is idle.

RaiseThreadMessage(MSG) RaiseThreadMessage(MSG) RaiseThreadMessage(MSG) RaiseThreadMessage(MSG)

Indicates that a new message is available for possible handling.


EnterThreadModal EnterThreadModal EnterThreadModal EnterThreadModal

Occurs when a thread becomes modal.

LeaveThreadModal LeaveThreadModal LeaveThreadModal LeaveThreadModal

Occurs when a modal thread becomes nonmodal.

ThreadFilterMessage ThreadFilterMessage ThreadFilterMessage ThreadFilterMessage

Occurs when the message pump receives a keyboard message.

ThreadIdle ThreadIdle ThreadIdle ThreadIdle

Occurs when the thread is idle.

ThreadPreprocessMessage ThreadPreprocessMessage ThreadPreprocessMessage ThreadPreprocessMessage

Occurs when the message pump receives a keyboard message.


to access any member of this class. Associated enumeration: Unrestricted

Applies to

See also