Home All Groups Group Topic Archive Search About

check caller before ServiceBase.Run?

Author
17 Nov 2006 9:31 PM
stevenkobes@hotmail.com
I have a service application in C#.  If the user double-clicks the
service EXE, I want to display a form with options to install or
uninstall.  In other words, I want:

static void Main()
{
  if (invoked by user) {   // <-- how to implement this?
    // display GUI...
  }
  else {  // invoked by SCM
    ServiceBase.Run(new ServiceBase[] { new MyServiceClass() });
  }
}

How can I determine how the EXE was invoked?

Thanks!
Steve

Author
17 Nov 2006 11:03 PM
Mattias Sjögren
>How can I determine how the EXE was invoked?

Try checking System.Environment.UserInteractive.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

AddThis Social Bookmark Button