M
mike_j_s
I thought this was going to be a simple question with a simple
solution, but I haven't been able to find an elegant way to accomplish
this. I have event logging code in a DLL assembly that is shared by
GUI applications and console applications. Events are being logged to
the Windows Event Log, and I would like to use the title of the
application as the "source" of each event. Naturally, this means that
for a GUI app, I need to get the title of the main window, and for a
console app, I need to get the title of the console window
("Console.Title"). What is the best way to accomplish this? I
haven't even been able to figure out a way to determine if the running
application is a GUI or console app. I know that I can access
"Console.Title" and if it throws an exception I can assume it's a GUI
application, but I was hoping for something more elegant.
Any ideas? Thank you in advance for your help.
- Mike
solution, but I haven't been able to find an elegant way to accomplish
this. I have event logging code in a DLL assembly that is shared by
GUI applications and console applications. Events are being logged to
the Windows Event Log, and I would like to use the title of the
application as the "source" of each event. Naturally, this means that
for a GUI app, I need to get the title of the main window, and for a
console app, I need to get the title of the console window
("Console.Title"). What is the best way to accomplish this? I
haven't even been able to figure out a way to determine if the running
application is a GUI or console app. I know that I can access
"Console.Title" and if it throws an exception I can assume it's a GUI
application, but I was hoping for something more elegant.
Any ideas? Thank you in advance for your help.
- Mike