Пример #1
0
        public static DispatcherQueueController CreateDispatcherQueueControllerForCurrentThread()
        {
            var options = new DispatcherQueueOptions
            {
                dwSize        = Marshal.SizeOf <DispatcherQueueOptions>(),
                threadType    = DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT,
                apartmentType = DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE
            };

            DispatcherQueueController controller = null;
            uint hr = CreateDispatcherQueueController(options, out IntPtr controllerPointer);

            if (hr == 0)
            {
                controller = DispatcherQueueController.FromAbi(controllerPointer);
                Marshal.Release(controllerPointer);
            }

            return(controller);
        }
Пример #2
0
 static extern uint CreateDispatcherQueueController(DispatcherQueueOptions options, out IntPtr dispatcherQueueController);