AttachConsole with Windows Service?

  • Thread starter Thread starter Steven Blair
  • Start date Start date
S

Steven Blair

I would like to launch a new Console Window when my Service starts up.
I tried using AttachConsole but this doesn't appear to work.
My guess is, this method is intended for GUI's only?

Any help would be appreciated.

Currently I need to connect to my Service via Telnet and allow the users
various options (means reading key entries over socket etc and the
Console would be much nicer)

Regards,

Steven
 
Steven said:
I would like to launch a new Console Window when my Service starts up.
I tried using AttachConsole but this doesn't appear to work.
My guess is, this method is intended for GUI's only?
Services cannot interact with the desktop unless you configure them that way
(and even that no longer works from Vista onwards, as they run in their own
isolated session). This is by design, because services typically run with
elevated privileges and allowing non-privileged programs to interact with
them is a security risk.
Currently I need to connect to my Service via Telnet and allow the users
various options (means reading key entries over socket etc and the
Console would be much nicer)
Directly interacting with telnet is about as bad as offering a console. The
standard approach is to have a completely separate process to handle any
user interface, using IPC to communicate with the service in a strictly
checked way.

If security isn't a concern to you (let's say you've configured the service
to run under a restricted account, and it's only a service because it needs
to be on 24-7) then the telnet approach would seem to be as good as any. A
direct interactive session isn't worth the trouble, if you want that I'd go
the separate process route.
 
Security isn't an issue, its all locked away from unauthorised users.
Telnet has been fine, but I use Telnet for displaying menu options and I
can't clear the screen, so the Console would have made it easier.

Thanks for your advice.
 
Back
Top