语言

DispatcherQueueController.CreateOnCurrentThread 方法

定义

在调用线程上,创建一个 DispatcherQueue ,它将与 USER32 消息循环互操作。

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

返回

调用线程上的 DispatcherQueue 。

注解

已创建 DispatcherQueue,并与当前线程关联。 如果已有与当前线程关联的 DispatcherQueue ,则会出现错误。 可以通过 DispatcherQueueController.DispatcherQueue 访问创建的 DispatcherQueue。

因此,调度程序队列可以调度任务,当前线程必须泵送消息。 在当前线程退出之前,它必须调用 DispatcherQueueController.ShutdownQueueAsync,并继续泵送消息,直到 IAsyncAction 完成;或者调用 DispatcherQueueController.ShutdownQueue,直到队列关闭才会返回。

适用于