語言

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,但該排隊直到隊列關閉後才會回傳。

適用於