c# - Exception changing focus with the tab key in a .NET application -
I have a very simple Windows application, with some controls, a datagrid view and Adobe PDF viewer control. When the app works fine except to leave the tab around paying attention to the switch between control, I regularly get the following exception.
System.AccessViolationException without attempted message = "Attempted to read or write protected memory. This time there is an indication that other memory is corrupt." Source = "System. Windows.Forms "StackTrace: System.Windows.Forms.NativeWindow.DefWndProc on System.Windows.Forms.UnsafeNativeMethods.CallWindowProc (IntPtr wndproc, IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam) (message & amp; m) System KWindowskFormskControlkDefWndProc (message & the Amp, m m), on the system) and in the (message System.Windows.Forms.Control.WndProc amp; m) System.Windows.Forms.AxHost.WndProc on ( Message & amp; Windows.Forms.Control.ControlNativeWindow.OnMes The Sage (Message & amp; M) in (message System.Windows.Forms.Control.ControlNativeWindow.WndProc & amp; M) on System.Windows.Forms.NativeWindow.DebuggableCallback (IntPtr hWnd, Int32 message, IntPtr wParam, Intpet Liparam) on System.Windows.org.Unsefrenetic Mediaps in Dispute Message (System) System .indofom.Commentant Manager. System. Windows .form. UNICEF Native Medications Comptant Manager System.Windows.Forms.Application.ThreadContext.RunMessageLoop on System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner on FUPM Message Leap (Int 32dv Compentant ID, Int 32 Reason, Int 32POLopadata) System.Windows.Forms.Application.Run (Int32 reason ApplicationContext context) (Int32 reason ApplicationContext context) (form the main farm) in Scan_ManagerkProgramkMain () D: \ Checkout \ code \ scan Manager \ scan Manager \ Program.cs: line System.AppDomain._nExecuteAssembly 17 (assembly assembly, string [] args) in System.AppDomain. ExecuteAssembly (String Assembly File, Evidence Assessment, String [] AGR) in Microsoft. Visual Studio. Hosting process Hostpro rate On the RURsSambands () system. threading. ThreadHalper Streadtracktax (object state) on the system. threading. Execution Conteks Krn (execution Contact Akstusn Conteks, context callback callback, state) object (System.Threading.ThreadHelper.ThreadStart) InnerException :?
Anyone had me talk in the right direction
Nks, jon
Update
after playing around with something else, it is only when Adobe control focus lost I can get somewhat by disabling your Tabstop am, but unfortunately when I use LoadFile to PDF load It automatically gets focused (and then when I close the tab, the app crashes)
This is one of those errors which are very difficult to troubleshoot, and the answer to this issue varies depending on that issue.
This can be a vibe, but if you are hosting an Acrobat Reader directly in your application, you can use the WebBozer control to display the document and set the document resource instead of the PDF Can try Web Browser is control, I believe (though I'm not sure) is based on Internet Explorer, and it is possible that Internet Explorer works better to host these controls more than pure. Net WinForms application I have some success which shows other files in such a way that if it works instead of trying to include a third party COM reference, please let me know.
Comments
Post a Comment