Re: Poweroff / shell

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Rob,

IIRC, it was not the Explorer but Winlogon that handled that broadcast and called to ExitWindow[Ex] API.
An old version of Minlogon was handling that message correctly as well, however that functionality got broken (or excluded) in newer
version.

You can verify if the above is true by reading lots of related threads in this NG archive.

Anyway, if you are running your own application as the shell you can always "fix" the behavior by providing your own handler for the
WM_POWERBROADCAST message. Basically if you catch the message by your window or thread proc, you should call a shutting the system
down API such as InitiateSystemShutdown, ExitWindowsEx, NTShutdownSystem (the fastest shutdown but not graceful), etc. Make sure
your app is granted SE_SHUTDOWN_NAME privilege first.
Or you can just execute command such as "xpepm.exe -shutdown" (Power Management Application component) or "fba -shutdown" or
"shutdown.exe -s -t 00 -f" if you prefer.

Some more info and ways how to intercept the power management events you can find in this thread:
http://groups.google.com/group/microsoft.public.windowsxp.embedded/browse_thread/thread/0d300155d7c44bbe

--
=========
Regards,
KM

Hi,
My Winxp embedded image that does NOT run Explorer.exe is not responding to
the power-off as it should. Am I correct in assuming that Explorer.exe
responds to the WM_POWERBROADCAST message, by shutting down the system ?

Now the system powers down "hard" (suddenly) after keeping the powerbutton
pressed 4 sec, without shutting dowbn nicely. When explorer.exe is running it
shuts down nicely. I need to add this behaviour to my app.

Any tips ?
Greetings,
Rob.


.



Relevant Pages

  • Re: Porting a DOS app to Windows
    ... > The application is in C and is using assembly code for ... Its been implemented in assembly via the interrupts ... delaying using a timer interrupt handler ... > routines in Win API. ...
    (comp.lang.asm.x86)
  • Re: strange functions binutils-2.21
    ... I already know what some of this API does but these functions like ... I don't think the sockets API has any ... Now in later code you can kake a pointer to this function: ... // Could make decisions to assign different values to handler here. ...
    (comp.lang.c)
  • Re: Winforms, Shown Event and SetEnvironmentVariable
    ... Timing done using "QueryThreadCycleTime" API (Vista and up), with Processor clock at fixed rate. ... If you just put a Stopwatch in the Shown event handler, start it before the two calls, and check the Elapsed time after them, what results do you get? ... Not that it's relevant to this question IMHO, but what's the .NET API for the QueryThreadCycleTime call? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: check-mark not showing on the popup sub-menu
    ... Working in Windows CE API, ... Then if you have the menu handler, ... lpszMenuItemResourceID /* Resource ID of menu item you want ti un/check */, ... Mateusz Łoskot mateusz at loskot dot net ...
    (microsoft.public.pocketpc.developer)
  • SNMP Get Reponse Question
    ... Since responses are handled asynchronous a response handler is registered ... In the old SNMP API ... Is possible to mix calls to the old SNMP API and the new WinSNMP API? ...
    (microsoft.public.win32.programmer.networks)