Input 如何获得背景键盘输入?
在Windows 10应用程序中,您可以通过以下方式从后台线程获得低延迟鼠标/笔/触摸输入:Input 如何获得背景键盘输入?,input,keyboard,uwp,Input,Keyboard,Uwp,在Windows 10应用程序中,您可以通过以下方式从后台线程获得低延迟鼠标/笔/触摸输入: var workItemHandler = new WorkItemHandler((action) => { SwapChainPanel mPanel = (SwapChainPanel)inputElement; CoreIndependentInputSource coreIndependentInputSource;
var workItemHandler = new WorkItemHandler((action) =>
{
SwapChainPanel mPanel = (SwapChainPanel)inputElement;
CoreIndependentInputSource coreIndependentInputSource;
coreIndependentInputSource = mPanel.CreateCoreIndependentInputSource(CoreInputDeviceTypes.Touch | CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse);
coreIndependentInputSource.PointerPressed += CoreWindow_PointerPressed;
coreIndependentInputSource.PointerMoved += CoreWindow_PointerMoved;
coreIndependentInputSource.PointerReleased += CoreWindow_PointerReleased;
coreIndependentInputSource.Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessUntilQuit);
});
但您必须从CoreWindow或UI元素提供的路由事件中获取键盘输入。(您也可以从windows获取鼠标输入,但它遇到了完全相同的问题)
这会导致鼠标移动/单击时键盘输入被阻止
如何在不使用鼠标输入延迟的路由事件的情况下获得键盘输入