Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ScreenSaver Notification

ScreenSaver Notification

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blake Miller
    wrote on last edited by
    #1

    What do you do in your top level window to be notified that the screensaver has become active? I want to respond to this and temporarily disable a periodic event. Likewise, what notification is received once the screensaver has been deactivated and your window is now 'visible' again, even though your window might not be the one that is the 'active' window?

    D F 2 Replies Last reply
    0
    • B Blake Miller

      What do you do in your top level window to be notified that the screensaver has become active? I want to respond to this and temporarily disable a periodic event. Likewise, what notification is received once the screensaver has been deactivated and your window is now 'visible' again, even though your window might not be the one that is the 'active' window?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      How about SetWindowsHookEx(WH_FOREGROUNDIDLE, ...) or SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, ...)?


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      B 1 Reply Last reply
      0
      • D David Crow

        How about SetWindowsHookEx(WH_FOREGROUNDIDLE, ...) or SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, ...)?


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        1. I could not see that the WH_FOREGROUNDIDLE would directly apply to the screensaver. I suppose if this event is detected, I could create a different timer to check the SystemParametersInfo every 30 seconds or so to see if the screensaver had become active. 2. This requires polling and is not a notification. I am looking for something sent to all 'top level windows' when the screensaver becomes active. I did find this one, WlxScreenSaverNotify, but I don't want to replace the GINA DLL.

        D 1 Reply Last reply
        0
        • B Blake Miller

          What do you do in your top level window to be notified that the screensaver has become active? I want to respond to this and temporarily disable a periodic event. Likewise, what notification is received once the screensaver has been deactivated and your window is now 'visible' again, even though your window might not be the one that is the 'active' window?

          F Offline
          F Offline
          Flit
          wrote on last edited by
          #4

          I saw this article in the MSDN, hope it helps. HOWTO: Know When Your Screen Saver Starts ID: Q238882

          F B 2 Replies Last reply
          0
          • B Blake Miller

            1. I could not see that the WH_FOREGROUNDIDLE would directly apply to the screensaver. I suppose if this event is detected, I could create a different timer to check the SystemParametersInfo every 30 seconds or so to see if the screensaver had become active. 2. This requires polling and is not a notification. I am looking for something sent to all 'top level windows' when the screensaver becomes active. I did find this one, WlxScreenSaverNotify, but I don't want to replace the GINA DLL.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Blake Miller wrote: 1. I could not see that the WH_FOREGROUNDIDLE would directly apply to the screensaver. My bad. Blake Miller wrote: 2. This requires polling and is not a notification. I am looking for something sent to all 'top level windows' when the screensaver becomes active. When a screen saver starts, it posts a WM_SYSCOMMAND message to the foreground window with wParam equal to SC_SCREENSAVE.


            "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

            1 Reply Last reply
            0
            • F Flit

              I saw this article in the MSDN, hope it helps. HOWTO: Know When Your Screen Saver Starts ID: Q238882

              F Offline
              F Offline
              Flit
              wrote on last edited by
              #6

              If you set a system wide hook for mouse and keyboard when you detect the screen saver has started you'll be able tell when the screen saver has stopped as it is mouse and keyboard activity that they respond to. Remember that for a system wide keyboard/mouse hook the hook functions need to be in a dll.

              B 1 Reply Last reply
              0
              • F Flit

                I saw this article in the MSDN, hope it helps. HOWTO: Know When Your Screen Saver Starts ID: Q238882

                B Offline
                B Offline
                Blake Miller
                wrote on last edited by
                #7

                :rolleyes: Now all I have to do is hope that EVERY possible application that has the foreground focus will post the SAME message to all other top level windows, and then we can all be notified when the screen saver starts. It still does not seem like a sure thing for every window...

                1 Reply Last reply
                0
                • F Flit

                  If you set a system wide hook for mouse and keyboard when you detect the screen saver has started you'll be able tell when the screen saver has stopped as it is mouse and keyboard activity that they respond to. Remember that for a system wide keyboard/mouse hook the hook functions need to be in a dll.

                  B Offline
                  B Offline
                  Blake Miller
                  wrote on last edited by
                  #8

                  Thanks. I already hook the low level mouse handler, I can just add a low level keyboard hook to that same DLL.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups