[Closed] pressing esc crashing dotnet dialogs
Hi there,
I am currently encountering some problems with dotnet dialogs that I remember having had in some older tools quite a few years ago already. If I recall correctly, those dotnet crashes occured with the Openfiledialog, which constantly crashed when the Escape key was pressed. I originally thought this was due to the control itself, but I am now running into the same problem when opening a form as a dialog. This is the basic functionality:
The main form is set to register keypress events, which collect controls at the cursor’s position and run different operations based on which type of control was found. Pressing Space on Pictureboxes for example opens a fullscreen dialog with the image at full resolution (similar to Adobe Bridge functionality). Pressing a key again closes the dialog. This all works but causes a dotnet crash if I try to leave the fullscreen dialog by pressing Escape.
Has anybody encountered similar problems and found a way to overcome them? I found two or three older threads on these sort of problems but unfortunately couldn’t find any solutions in them.
Here is a bit of extra information and workaround I am currently using.
The error message:
*********** Exception Text ***********
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at MXS_dotNet.DotNetObjectWrapper.RunEventHandlers(DotNetObjectWrapper* , Value* target, Value* eventName, Array* handlers, Object[] delegateArgsArray)
at MXS_dotNet.DotNetObjectWrapper.ProcessEvent(DotNetObjectWrapper* , String eventName, Object delegateArgs)
at MXS_dotNet.DotNetObjectManaged.delegate_proxy_type.ProcessEvent(String eventName, Object delegateArgs)
at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Temporary solution:
I am currently setting escapeEnable to false before opening the dialog and restoring it to true when the dialog is closed.
Thanks in advance!
Andy