This topic has not yet been rated - Rate this topic

ComponentDispatcher Class

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

System.Object
  System.Windows.Interop.ComponentDispatcher

Namespace:  System.Windows.Interop
Assembly:  WindowsBase (in WindowsBase.dll)
public static class ComponentDispatcher

The ComponentDispatcher type exposes the following members.

  Name Description
Public property Static member CurrentKeyboardMessage Gets the last message that was raised.
Public property Static member IsThreadModal Gets a value that indicates whether the thread is modal.
Top
  Name Description
Public method Static member PopModal Called to indicate that a modal thread is no longer modal.
Public method Static member PushModal Called to indicate that the thread is modal.
Public method Static member RaiseIdle Called to indicate that a thread is idle.
Public method Static member RaiseThreadMessage Indicates that a new message is available for possible handling.
Top
  Name Description
Public event Static member EnterThreadModal Occurs when a thread becomes modal.
Public event Static member LeaveThreadModal Occurs when a modal thread becomes nonmodal.
Public event Static member ThreadFilterMessage Occurs when the message pump receives a keyboard message.
Public event Static member ThreadIdle Occurs when the thread is idle.
Public event Static member ThreadPreprocessMessage Occurs when the message pump receives a keyboard message.
Top

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.

Note Note

Only keyboard messages are supported.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ