Service starts too early

Windows specific forum
Balmung
User
User
Posts: 24
Joined: Sat Dec 22, 2018 9:15 pm

Service starts too early

Post by Balmung »

I run into a little problem. I registered my program as a Service and after a reboot it starts but it shows not his TrayIcon. I think it starts too early before the User is logged in (starts as SYSTEM).

How could i fix this? I first thought I check if the User is logged in or delay the start, but maybe i run into the wrong direction to fix this and there is a more correct one? How does other Services starts after User login?
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: Service starts too early

Post by Rings »

afaik,

services cannot have gui elements. cannot create windows, also not a systray icon.

But they can run without a user logged in, without a "gui" running .

You have to interact with an extra exe (which do the gui stuff)
with the service via sockets or shared memory(or something other i forgot) .
The extra exe can only run if the/a user is logged in and you have to put it
in the autostart folder or start via taskplanner
SPAMINATOR NR.1
Balmung
User
User
Posts: 24
Joined: Sat Dec 22, 2018 9:15 pm

Re: Service starts too early

Post by Balmung »

Sorry, I described it wrong: i already start a extra program over that own Service program, but this Service program start the main program too early on boot up and that Service is only there for Autostart this program on boot, because it need Admin rights.

The rest is not true at all, see JHPJHPs example script of his Service Library. The Service didn't need a data exchange with the program it runs at all. And also it don't need to be in Taskscheduler or Autostart at all, other programs use that also without that to start themselves on boot.

But like i said, the Service starts my GUI program too early.

Edit: did not need it anymore, i used schtasks with runprogram() to make a Autostart without to use a Service for it.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Service starts too early

Post by Rinzwind »

Services can't interact with the active user session (it always runs in session 0) since Vista, not without hacks.
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: Service starts too early

Post by Rings »

Balmung wrote:Edit: did not need it anymore, i used schtasks with runprogram() to make a Autostart without to use a Service for it.
that is the way.
SPAMINATOR NR.1
Post Reply