private static void RunForm() { Log.Information("Starting WindowsAPIAdapter thread"); if (_exceptionEventHandler != null) { Application.ThreadException += _exceptionEventHandler; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += (sender, args) => _exceptionEventHandler(sender, new ThreadExceptionEventArgs((Exception)args.ExceptionObject)); } _instance = new WindowsAPIAdapter(); _instance.CreateHandle(); Log.Information("Handle created. Running the application."); Application.Run(_instance); Log.Information("End of the WindowsAPIAdapter thread"); }
private static void RunForm() { Log.Information("Starting WindowsAPIAdapter thread"); if (_exceptionEventHandler != null) { Application.ThreadException += _exceptionEventHandler; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += (sender, args) => _exceptionEventHandler(sender, new ThreadExceptionEventArgs((Exception)args.ExceptionObject)); } _instance = new WindowsAPIAdapter(); _instance.CreateHandle(); _instance._msgNotifyShell = Interop.RegisterWindowMessage("SHELLHOOK"); Interop.RegisterShellHookWindow(User32.NativeMethods.HWND.Cast(_instance.Handle)); Log.Information("Handle created. Running the application."); Application.Run(_instance); Log.Information("End of the WindowsAPIAdapter thread"); }