同时,使用手写笔或一个WPF应用程序手指按压触摸屏上的一个按钮时发生异常 [英] Exception occurs while pressing a button on TouchScreen using a Stylus or a finger in a WPF app

查看:523
本文介绍了同时,使用手写笔或一个WPF应用程序手指按压触摸屏上的一个按钮时发生异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与显示为闪屏在启动时的初始窗口WPF应用程序。在启动过程中有一个后台线程,我们可以通过点击闪屏的按钮来取消这个线程。同时使用鼠标和点击按钮取消
这一切工作正常。但是如果我使用触摸屏来点击这个按钮,然后occasionaly应用程序崩溃,下面是堆栈跟踪。该应用程序是运行在Windows 7 64位64位的目标。

I have WPF app with an initial window which shows up as Splashscreen at Startup. During the Startup there is a background thread and we can cancel the this thread by clicking the button in splashscreen. This all works fine while using mouse and clicking the button to cancel. However if I use the touchscreen to click on this button then occasionaly the app crashes and following is the stack trace. The app is a 64bit target running on windows 7 64bit.

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

有没有人遇到过这个问题吗?

Has anyone encountered this problem before?

推荐答案

您使用的Elo触摸屏?我在StylusLogic OnDispatcherShutdown类似的碰撞与的Elo触摸屏。我已经解决了它,用禁用RealTimeStylus为WPF(的禁用WPF应用程序)的RealTimeStylus。它接缝对我来说,该事件被处理两次(在显示驱动器和WPF手写笔),但在WPF笔处理程序已经被破坏的窗口。还呼吁关闭窗口前,一点点延迟为我工作。

Are you using Elo touch screen? I have a similar crash in StylusLogic OnDispatcherShutdown with Elo touch display. I have solved it, with disabling the RealTimeStylus for wpf (Disable the RealTimeStylus for WPF Applications). It seams to me, that the event is handled twice (in display driver and wpf stylus), but on the wpf Stylus handler the window is already destroyed. Also a little delay before calling close window has worked for me.

这篇关于同时,使用手写笔或一个WPF应用程序手指按压触摸屏上的一个按钮时发生异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆