Because the window station is shutting down

Sun, 18 Jul 2004 17:24:35 GMT

application failed to initialize because the window station is shutting down

Hi,

"Application popup: calc.exe - DLL Initialization Failed : The application
failed to initialize because the window station is shutting down."

This is the error message that is appearing when I log off Windows 2000. The
reason is that my NT service is continuosly checking to make sure that
"calc.exe" (for examples sake) is running. If the user closes it, my service
will recreate it no problems.

The problem is that when the user logs off, Windows will rightfully
terminate the program. My NT service should realise that the user is logging
off and not attempt to start the application anymore but it doesn't. I am
detecting that the user is still logged on by checking for the existing of
explorer.exe. How can I accurately detect if the window station is being
shutdown. My psuedo-code is similar to the following:

if explorer.exe is currently running then    // check if a user is logged in
  if calc.exe is not running then                // check if we need to
start the process
     start calc.exe                                    // start the process

--
Chazza

Thomas Stut

Because the window station is shutting down

Delphi Developer

Sun, 18 Jul 2004 17:38:10 GMT

Re:application failed to initialize because the window station is shutting down

Hi,

The WM_QUERYENDSESSION message is sent to all applications
when the user chooses to end the session or when an application calls the
ExitWindows function.
If any application returns zero, the session is not ended.
The system stops sending WM_QUERYENDSESSION messages as soon as one
application
returns zero.
After processing this message, the system sends the WM_ENDSESSION message
with the
wParam parameter set to the results of the WM_QUERYENDSESSION message.

tom

Quote
"Chazza" <> wrote in message news:3c57bbd4_2@dnews...
> Hi,

> "Application popup: calc.exe - DLL Initialization Failed : The application
> failed to initialize because the window station is shutting down."

> This is the error message that is appearing when I log off Windows 2000.
The
> reason is that my NT service is continuosly checking to make sure that
> "calc.exe" (for examples sake) is running. If the user closes it, my
service
> will recreate it no problems.

> The problem is that when the user logs off, Windows will rightfully
> terminate the program. My NT service should realise that the user is
logging
> off and not attempt to start the application anymore but it doesn't. I am
> detecting that the user is still logged on by checking for the existing of
> explorer.exe. How can I accurately detect if the window station is being
> shutdown. My psuedo-code is similar to the following:

> if explorer.exe is currently running then    // check if a user is logged
in
>   if calc.exe is not running then                // check if we need to
> start the process
>      start calc.exe                                    // start the
process

Chazz

Because the window station is shutting down

Delphi Developer

Sun, 18 Jul 2004 18:02:30 GMT

Re:application failed to initialize because the window station is shutting down

I'll give it a try, although Im not sure if that will help. It is the
service which needs to know when the user is logging off and I dont think
the service can receive that message unless it is interactive. Unfortunately
interactive services are a bad idea as they dont work well in Windows XP. So
maybe child process can tell the service that it is being shutdown and not
to attempt to restart the process for x seconds or so...

--
Chazza

Quote
"Thomas Stutz" <> wrote in message

news:3c57bf14$1_2@dnews...

Quote
> Hi,

> The WM_QUERYENDSESSION message is sent to all applications
> when the user chooses to end the session or when an application calls the
> ExitWindows function.
> If any application returns zero, the session is not ended.
> The system stops sending WM_QUERYENDSESSION messages as soon as one
> application
> returns zero.
> After processing this message, the system sends the WM_ENDSESSION message
> with the
> wParam parameter set to the results of the WM_QUERYENDSESSION message.

> tom

> "Chazza" <> wrote in message news:3c57bbd4_2@dnews...
> > Hi,

> > "Application popup: calc.exe - DLL Initialization Failed : The
application
> > failed to initialize because the window station is shutting down."

> > This is the error message that is appearing when I log off Windows 2000.
> The
> > reason is that my NT service is continuosly checking to make sure that
> > "calc.exe" (for examples sake) is running. If the user closes it, my
> service
> > will recreate it no problems.

> > The problem is that when the user logs off, Windows will rightfully
> > terminate the program. My NT service should realise that the user is
> logging
> > off and not attempt to start the application anymore but it doesn't. I
am
> > detecting that the user is still logged on by checking for the existing
of
> > explorer.exe. How can I accurately detect if the window station is being
> > shutdown. My psuedo-code is similar to the following:

> > if explorer.exe is currently running then    // check if a user is
logged
> in
> >   if calc.exe is not running then                // check if we need to
> > start the process
> >      start calc.exe                                    // start the
> process

Ndi

Because the window station is shutting down

Delphi Developer

Mon, 19 Jul 2004 08:51:00 GMT

Re:application failed to initialize because the window station is shutting down

On XP you can use SystemParametersInfo:

      SM_SHUTTINGDOWN Whistler: TRUE if the current session is shutting
down; FALSE otherwise.

--
Andrei "Ndi" Dobrin
NDI Group
Brainbench MVP for Windows 95
www.brainbench.com

Werner Cloet

Because the window station is shutting down

Delphi Developer

Mon, 19 Jul 2004 18:15:53 GMT

Re:application failed to initialize because the window station is shutting down

  Your service should stop restarting calc.exe when Windows is shutting
down...

  Have a look at the thread started by Molna Sen on 28/01/2002 at 20:43 with
the subject "Abort shutdown not working on service app. ??"...

  HTH

Quote
"Chazza" <> wrote in message news:3c57bbd4_2@dnews...

: Hi,
:
: "Application popup: calc.exe - DLL Initialization Failed : The application
: failed to initialize because the window station is shutting down."
:
: This is the error message that is appearing when I log off Windows 2000.
The
: reason is that my NT service is continuosly checking to make sure that
: "calc.exe" (for examples sake) is running. If the user closes it, my
service
: will recreate it no problems.
:
: The problem is that when the user logs off, Windows will rightfully
: terminate the program. My NT service should realise that the user is
logging
: off and not attempt to start the application anymore but it doesn't. I am
: detecting that the user is still logged on by checking for the existing of
: explorer.exe. How can I accurately detect if the window station is being
: shutdown. My psuedo-code is similar to the following:
:
: if explorer.exe is currently running then    // check if a user is logged
in
:   if calc.exe is not running then                // check if we need to
: start the process
:      start calc.exe                                    // start the
process
:
: --
: Chazza
:

Other Threads