使用手写笔或WPF应用程序中的手指按下TouchScreen上的按钮时发生异常

inn*_*kas 4 c# wpf stylus-pen

我有一个WPF应用程序,其初始窗口在启动时显示为Splashscreen.在Startup期间有一个后台线程,我们可以通过单击splashscreen中的按钮取消该线程.使用鼠标并单击按钮取消时,一切正常.但是,如果我使用触摸屏点击此按钮,则偶尔应用程序崩溃,然后是堆栈跟踪.该应用程序是在Windows 7 64位上运行的64位目标.

Severity:
Fatal


Stack Trace:
Exception 0
Message: Object reference not set to an instance of an object.

StackTrace:

at MS.Internal.PointUtil.TryClientToRoot(Point point, PresentationSource presentationSource, Boolean throwOnError, Boolean& success)
at System.Windows.Input.StylusDevice.GetPosition(IInputElement relativeTo)
at System.Windows.Input.StylusDevice.ChangeStylusOver(IInputElement stylusOver)
at System.Windows.Input.StylusLogic.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.PossiblyDeactivate(IntPtr hwndCapture, Boolean stillActiveIfOverSelf)
at System.Windows.Interop.HwndMouseInputProvider.Dispose()
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

FromSubsystem:
PresentationCore
Help Link:
Not specified
Run Code Online (Sandbox Code Playgroud)

以前有人遇到过这个问题吗?

Luz*_*Gan 5

你在使用Elo触摸屏吗?我在StylusLogic OnDispatcherShutdown中使用Elo触摸显示器发生了类似的崩溃.我解决了这个问题,禁用了RealTimeStylus for wpf(为WPF应用程序禁用RealTimeStylus).它接触到我,事件被处理两次(在显示驱动程序和wpf手写笔中),但在wpf Stylus处理程序上,窗口已被销毁.在调用关闭窗口之前还有一点延迟对我有用.