I was wondering whether anyone know's a way to detect whether the current application is a console or a winforms application.

The reason that I want to do this is that I am developing a library with a global error handler in it and I need to know what type of application it is in order to be able to subscribe to the appropriate exception event.

Obviously I could get the user to pass in a parameter specifying what type of application it is, but I would rather deal with that automatically so its all encapsulated from the user of the class.

Thanks for any help in advance.

Satal