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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Keeping a System "alive"

Keeping a System "alive"

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 6 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.
  • realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #1

    I'm writing an app for a system that is configured by the IT department to turn on the screen saver after 15 minutes of inactivity, and requires a password when the system is re-activated. I tried programatically moving the mouse 100 pixels and then immediately back to it's original position, but that didn't work. I've also tried broadcasting the SC_HOTKEY message. This kind of worked, but when I closed the app, it crashed. Does anyone have any ideas? ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

    C M 2 Replies Last reply
    0
    • realJSOPR realJSOP

      I'm writing an app for a system that is configured by the IT department to turn on the screen saver after 15 minutes of inactivity, and requires a password when the system is re-activated. I tried programatically moving the mouse 100 pixels and then immediately back to it's original position, but that didn't work. I've also tried broadcasting the SC_HOTKEY message. This kind of worked, but when I closed the app, it crashed. Does anyone have any ideas? ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      Just to clarify, are you trying to inhibit the screen saver from going off? I'm suspecting yes is the answer, which prompts the next question, once the screen saver has gone off, what's that do to your app such that it stops doing what it's supposed to be doing? Chris Meech I am Canadian. [heard in a local bar] When I want privacy, I'll close the bathroom door. [Stan Shannon] BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

      realJSOPR 1 Reply Last reply
      0
      • C Chris Meech

        Just to clarify, are you trying to inhibit the screen saver from going off? I'm suspecting yes is the answer, which prompts the next question, once the screen saver has gone off, what's that do to your app such that it stops doing what it's supposed to be doing? Chris Meech I am Canadian. [heard in a local bar] When I want privacy, I'll close the bathroom door. [Stan Shannon] BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        The problem is that the user has to log back on to the system after the screen saver comes on. I want to prevent the screensaver from coming on in the first place. I can't just turn the screensaver off because that's not permitted under our security policies. The app that will be doing this is in a hospital Emergency Room, and they don't want the screen to go into screensaver mode at all.Instead of fighting with the IT idiots, I just want to simulate activity that doesn't otherwise inhibit actual use of the program. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        C C 2 Replies Last reply
        0
        • realJSOPR realJSOP

          I'm writing an app for a system that is configured by the IT department to turn on the screen saver after 15 minutes of inactivity, and requires a password when the system is re-activated. I tried programatically moving the mouse 100 pixels and then immediately back to it's original position, but that didn't work. I've also tried broadcasting the SC_HOTKEY message. This kind of worked, but when I closed the app, it crashed. Does anyone have any ideas? ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          SetThreadExecutionState(ES_DISPLAY_REQUIRED|ES_CONTINUOUS); --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          R 1 Reply Last reply
          0
          • realJSOPR realJSOP

            The problem is that the user has to log back on to the system after the screen saver comes on. I want to prevent the screensaver from coming on in the first place. I can't just turn the screensaver off because that's not permitted under our security policies. The app that will be doing this is in a hospital Emergency Room, and they don't want the screen to go into screensaver mode at all.Instead of fighting with the IT idiots, I just want to simulate activity that doesn't otherwise inhibit actual use of the program. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            C Offline
            C Offline
            Chris Gao
            wrote on last edited by
            #5

            Oooooooops~~ "this is in a hospital Emergency Room" ??! have you thought about that your application may fail for whatever reason? Then, who will response for that if it happens? If I were you, I would like to write a formal report to your boss to talk about this issue instead of taking some technical way to hide it. What do you think about it? Regards, Chris

            R 1 Reply Last reply
            0
            • realJSOPR realJSOP

              The problem is that the user has to log back on to the system after the screen saver comes on. I want to prevent the screensaver from coming on in the first place. I can't just turn the screensaver off because that's not permitted under our security policies. The app that will be doing this is in a hospital Emergency Room, and they don't want the screen to go into screensaver mode at all.Instead of fighting with the IT idiots, I just want to simulate activity that doesn't otherwise inhibit actual use of the program. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

              C Offline
              C Offline
              Chris Meech
              wrote on last edited by
              #6

              I'd be interested to hear if Michael's suggestion does the trick. The MSDN documentation specifically states that the function will not prevent the screen saver from executing, but we all now how that can be wrong. The docs also state that the call should be used by multimedia players when playing long videos and I have often wondered how my video recording software accomplished just that. This likely is the reason. Chris Meech I am Canadian. [heard in a local bar] When I want privacy, I'll close the bathroom door. [Stan Shannon] BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

              realJSOPR 1 Reply Last reply
              0
              • C Chris Gao

                Oooooooops~~ "this is in a hospital Emergency Room" ??! have you thought about that your application may fail for whatever reason? Then, who will response for that if it happens? If I were you, I would like to write a formal report to your boss to talk about this issue instead of taking some technical way to hide it. What do you think about it? Regards, Chris

                R Offline
                R Offline
                Rick York
                wrote on last edited by
                #7

                "Oooooooops~~ "this is in a hospital Emergency Room" ??! have you thought about that your application may fail for whatever reason? Then, who will response for that if it happens?" What does this have to do with his question ? :rolleyes:

                1 Reply Last reply
                0
                • C Chris Meech

                  I'd be interested to hear if Michael's suggestion does the trick. The MSDN documentation specifically states that the function will not prevent the screen saver from executing, but we all now how that can be wrong. The docs also state that the call should be used by multimedia players when playing long videos and I have often wondered how my video recording software accomplished just that. This likely is the reason. Chris Meech I am Canadian. [heard in a local bar] When I want privacy, I'll close the bathroom door. [Stan Shannon] BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

                  realJSOPR Offline
                  realJSOPR Offline
                  realJSOP
                  wrote on last edited by
                  #8

                  Nope, didn't work, and I even tried using the WM_POWERMESSAGE handler in WndProc too. Nothing seems to be able to keep this from happening. I've kinda given up - gotta move on. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                  C 1 Reply Last reply
                  0
                  • realJSOPR realJSOP

                    Nope, didn't work, and I even tried using the WM_POWERMESSAGE handler in WndProc too. Nothing seems to be able to keep this from happening. I've kinda given up - gotta move on. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                    C Offline
                    C Offline
                    Chris Meech
                    wrote on last edited by
                    #9

                    I see you didn't have success. Too bad. Did you come across this article[^] when researching. It seems to suggest that it will work. Chris Meech I am Canadian. [heard in a local bar] When I want privacy, I'll close the bathroom door. [Stan Shannon] BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

                    1 Reply Last reply
                    0
                    • M Michael Dunn

                      SetThreadExecutionState(ES_DISPLAY_REQUIRED|ES_CONTINUOUS); --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                      R Offline
                      R Offline
                      Rudolf Jan
                      wrote on last edited by
                      #10

                      I happend to face the same problem. This solution seems to work, but you should keep in mind that it does nothing more but resetting some timers. So you need to create a timer event and invoke the function when the timer expires. Thanks for this idea however!:):)

                      M 1 Reply Last reply
                      0
                      • R Rudolf Jan

                        I happend to face the same problem. This solution seems to work, but you should keep in mind that it does nothing more but resetting some timers. So you need to create a timer event and invoke the function when the timer expires. Thanks for this idea however!:):)

                        M Offline
                        M Offline
                        Michael Dunn
                        wrote on last edited by
                        #11

                        You shouldn't have to do that if you pass the ES_CONTINUOUS flag

                        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                        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