Creates a DispatcherQueueController on the caller's thread. Use the created DispatcherQueueController to create and manage the lifetime of a DispatcherQueue to run queued tasks in priority order on the Dispatcher queue's thread.
HRESULT CreateDispatcherQueueController( DispatcherQueueOptions options, ABI::Windows::System::IDispatcherQueueController **dispatcherQueueController );
The threading affinity and type of COM apartment for the created DispatcherQueueController. See remarks for details.
The created dispatcher queue controller.
S_OK for success; otherwise a failure code.
Introduced in Windows 10, version 1709.
If options.threadType is DQTYPE_THREAD_DEDICATED, then this function creates the dedicated thread and then creates the DispatcherQueueController on that thread. The dispatcher queue event loop runs on the new dedicated thread.
An event loop runs asynchronously on a background thread to dispatch queued task items to the new dedicated thread.
If options.threadType is DQTYPE_THREAD_CURRENT, then the DispatcherQueueController instance is created on the current thread. An error results if there is already a IDispatcherQueueController on the current thread. If you create a dispatcher queue on the current thread, ensure that there is a message pump running on the current thread so that the dispatcher queue can use it to dispatch tasks.
This call does not return until the new thread and DispatcherQueueController are created. The new thread will be initialized using the specified COM apartment.