jhammer
January 30th, 2006, 06:48 AM
How can I know at run-time what is the type of the executing assembly: Is it Windows application or Console application?
I need this in order to know where to redirect my output.
klintan
January 30th, 2006, 07:03 AM
You could look at the Application.MessageLoop property in System.Windows.Forms, it is false for the main thread for Console applications, and true for the main thread for Windows application.
But if this method is called from another thread in a Windows application it is probably false also.
I don't know if there is a direct way to figure out type of application.
jmcilhinney
January 30th, 2006, 10:50 PM
You could test the MainWindowHandle property of the CurrentProcess. It will be zero for a console app and something else for a WinForms app.