Share via


DispatcherQueueController.CreateOnCurrentThread Method

Definition

On the calling thread, creates a DispatcherQueue that will interop with a USER32 message loop.

public:
 static DispatcherQueueController ^ CreateOnCurrentThread();
 static DispatcherQueueController CreateOnCurrentThread();
public static DispatcherQueueController CreateOnCurrentThread();
function createOnCurrentThread()
Public Shared Function CreateOnCurrentThread () As DispatcherQueueController

Returns

The DispatcherQueue on the calling thread.

Remarks

A DispatcherQueue is created, and associated with the current thread. An error results if there's already a DispatcherQueue associated with the current thread. You can access the created DispatcherQueue through DispatcherQueueController.DispatcherQueue.

So that the dispatcher queue can dispatch tasks, the current thread must pump messages. Before the current thread exits, it must call DispatcherQueueController.ShutdownQueueAsync, and continue pumping messages until the IAsyncAction completes; or else call DispatcherQueueController.ShutdownQueue, which doesn't return until the queue is shut down.

Applies to