DLL tell what type of application is running.

M

Mr. Magic

I'm writing a general purpose error handler that will be used by Windows
Apps, Web Apps, Window's Services, ... In other words - just about any
program will be calling it. Part of this error routine would be to put up a
message box if it's a windows app but only if it's a windows app. How can I
make sure that the application that is running is actually a Window's app. I
currently am passing in parameters to display the message if appropriate but
I want to make sure that somebody doesn't by accident call the routine with
a message to display for something like a service which would cause
problems.

Any thoughts or suggestions?

TIA - J.
 
P

Peter Duniho

Mr. Magic said:
I'm writing a general purpose error handler that will be used by Windows
Apps, Web Apps, Window's Services, ... In other words - just about any
program will be calling it. Part of this error routine would be to put
up a message box if it's a windows app but only if it's a windows app.
How can I make sure that the application that is running is actually a
Window's app. I currently am passing in parameters to display the
message if appropriate but I want to make sure that somebody doesn't by
accident call the routine with a message to display for something like a
service which would cause problems.

Any thoughts or suggestions?

I think you could probably get that to work by looking for certain
"hallmark" features of console vs forms vs web applications. But, this
is supposed to be a general purpose error handler, right? Why not just
have the client code initialize it appropriately to the context?

Pete
 
P

Patrice

Perhaps by using the AppDomain (if I remember I was it used to find out if
something is hosted in IIS or not for example) but my personal preference
would be likely to just have a provider based architecture and configure the
provider for the application once for all...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top