How to: distinguish ShutDown Message from Restart Message

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Wang Qing (WangQing_at_discussions.microsoft.com)
Date: 08/31/04


Date: Mon, 30 Aug 2004 22:41:05 -0700

I meet a problem. I use Windows API ExitWindowEx to exit windows XP. Then the
Windows XP will send WM_QUERYENDSESSION and WM_ENDSESSION to all
applications. But I write a program (application) to detect whether the XP
wants to shutdown the system or restart the system. How can my application
distinguish them through Windows Message?

And the same problem exists suspending the system and hibernating the system.

The second problem is I can use API WTSRegisterSessionNotification and then
wait for WM_WTSSESSION_CHANGE (WTS_SESSION_LOGON) to know whether a user is
logging in. But does there exist a method to detect a user wants to log in,
so I can deny its logging in?

If I use WTS_SESSION_LOGON, in fact it has logged in. So, I need a Windows
Message to know the logging in before it logged in.

Welcome any advice. Thanks.

-- 
--wang qing


Relevant Pages

  • How to: Distinguish System ShutDown from Restart
    ... I use Windows API ExitWindowEx to exit windows XP. ... distinguish them through Windows Message? ... so I can deny its logging in? ...
    (microsoft.public.win32.programmer.wmi)
  • Re: How to: distinguish ShutDown Message from Restart Message
    ... cases Windows will be shut down. ... You can't use windows messages for that. ... I use Windows API ExitWindowEx to exit windows XP. ... > so I can deny its logging in? ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Why is Windows such a piece of Crap
    ... For all the rest of ya'll "Pros" out there, Bill Gates made Windows for me, ... Or at least give me the opportunity to turn on logging. ... They that can give up essential liberty to obtain a little temporary ... safety deserve neither liberty nor safety. ...
    (microsoft.public.windowsxp.general)
  • Re: Two Megabytes of Core Memory in 1965
    ... > I quadruple boot to=FreeDOS, QNX, Slackware linux, and Windows 2000. ... > Logging of real-time clock battery errors. ...
    (comp.arch.embedded)
  • Re: How to change Windows server 2003 Domain User password?
    ... I am using Windows Xp pro SP2 as a client to connect to Windows ... log in with their own accounts - that's the best way to do this.You're kinda ... If they're logging into a local account, create an AD user with the same ... the domain users to change password every 15 days. ...
    (microsoft.public.windowsxp.security_admin)