Possible to replace the central error message box?

Add-in Express™ Support Service
That's what is more important than anything else

Possible to replace the central error message box?
 
uwekeim




Posts: 14
Joined: 2012-09-09
Trying to give my Outlook add-in a more polished look, I'm looking for a central way to replace the error message box, that is automatically shown:

User added an image

Is there some kind of handler that I could override to show my own message handling GUI?

Thanks
UWe
Posted 20 Sep, 2012 10:31:55 Top
Eugene Astafiev


Guest


Hi Uwe,

Please consider using the OnError event of the add-in module class for suppressing error message boxes. For example:

private void AddinModule_OnError(ADXErrorEventArgs e)
{
    e.Handled = true;
}
Posted 20 Sep, 2012 11:13:06 Top
uwekeim




Posts: 14
Joined: 2012-09-09
Thanks Eugene

Is it safe to show a WinForms Form in that handler?

Like e.g. this pseudo code:

var window = new OutlookWin32Window  (OutlookApp.ActiveWindow  ());
MessageBox.Show( wind ow, "Error", e.ADXError.Message, ...);


Thanks
Uwe
Posted 20 Sep, 2012 12:19:31 Top
Eugene Astafiev


Guest


Hi Uwe,

Of course, you can use the OnError event handler for displaying your own dialog.

P.S. Please note that the ActiveWindow method returns either an Explorer or an Inspector object (see the Outlook Object Model) which should be released after. You can read more about this in the [URL=http://www.add-in-express.com/creating-addins-blog/2008/10/30/releasing-office-objects-net/]When to release COM objects in Office add-ins developed in .NET/URL] article on our technical blog.
Posted 21 Sep, 2012 05:57:38 Top
uwekeim




Posts: 14
Joined: 2012-09-09
Thanks a lot, Eugene!

Best regards from Germany
Uwe
Posted 21 Sep, 2012 06:51:48 Top