Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if app is running as GUI or Service

Status
Not open for further replies.

boflexson

Programmer
Oct 16, 2001
74
0
0
US
I need some method to determine if the code that is executing in a GUI app or as a Windows Service.

I have some code in a dll that will either present a message box (in gui mode) to the user, or write to the event log (in windows service mode). How can I tell which mode the code is executing in?

-Adam T. Courtney
 
Maybe you could have a parameter that the calling code could set to say which it was.

Durkin
 
You could also find your service in the scm and click on properties. Go to the local tab, then check allow service to interact with desktop. Once this is done your service can throw a msgbox just as a regular application. If you want to do this on install, there is a registry key you can set.
 
I found this:

Environment.UserInteraction



-Adam T. Courtney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top