CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Posts
    89

    Delay Windows shutdown

    I have a Windows service in which I need to detect the Windows shutdown event and, depending on what kind of processing I am doing at the time, delay the shutdown for a few seconds until my processing is complete. Can that be done?

    Any help appreciated.

  2. #2
    Join Date
    May 2007
    Posts
    680

    Re: Delay Windows shutdown

    I'm not a hundred percent sure but I think I recall a message(maybe WM_SYSCOMMAND) that returns a value in wParam that tells you that windows is shutting down... And if you return false it won't...
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  3. #3
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Delay Windows shutdown

    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  4. #4
    Join Date
    May 2004
    Posts
    89

    Re: Delay Windows shutdown

    Thanks everyone for the help. I know about the WM_QUERYENDSESSION message and how to handle it. Originally, I was looking for a way to get around the hidden window in my service, but because I have to interact with my user, I must use it. I found that the AbortShutdown() API function is what I need to use to delay the system shutdown.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured