[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 584
  • Last Modified:

Can a Windows Service start a process that has UI stuff in it?

The service is started in the LocalSystem, I've got it controlling some processes which start ok, and show up in task manager - but none of their UI appears (notifyIcon, Form, MessageBox, etc).

Is this because it's running as SYSTEM? I tried running it as User, but when I tried to install the service it asked for my username password - which I entered correctly - but it rejected them.
0
salted
Asked:
salted
  • 2
  • 2
1 Solution
 
gregoryyoungCommented:
In order to have the UI stuff show up you would need to "Allow interaction with desktop" for the service, you can do this in the service properties (check box under the login info) ... This does however have some security implications and is generally frowned upon.

If you are running GUI stuff in a service that GUI stuff should probably be in another app that communicates with the service as opposed to within the service itself.

Cheers,

Greg
0
 
saltedAuthor Commented:
> If you are running GUI stuff in a service that GUI stuff should probably be in another app that communicates with the service as opposed to within the service itself.

That's what I'm trying to do :) I'm using the service to manage the processes, it's a server app so I need the service to make sure processes are running when they should be - would you say an app in startup would do this better? It just seemed perfect for a service. (All the service currently does is control the processes).
0
 
gregoryyoungCommented:
it can work ... but keep in mind a service runs even when there are no logged on users etc.

The processes you are creating sound like they may be better off as services themselves :)
0
 
saltedAuthor Commented:
Yes, the problem is that they are using the WebBrowser control for some web crawling stuff (I need mshtml's .InnerText property among others). And to run just one at once would take days, so if I put them in a service, the only option left would be multi-threading - but the WebBrowser control isn't thread-safe :(

I only need the settings dialog and notify icon to be visible (which are already in their own app), so I guess I could stop the service launching this particular app, and instead add into startup - so it only actually shows when the server's administrator logs in.

I'm going to do that - thanks for your help Greg.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now