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. screensaver problem

screensaver problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++algorithms
11 Posts 4 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.
  • X Offline
    X Offline
    xxhimanshu
    wrote on last edited by
    #1

    :confused:Hi all, I have a small problem..I have an MFC application..and I want to enable screensaver or disable screensaver on meeting some condition...can I do it..I tried searching for it in google, codeproject etc..but hard luck...nothing is there..can anyone out there help me out...any help or pointers are highly appreciated.. Thanks a lot in advance.. Himanshu

    R 1 Reply Last reply
    0
    • X xxhimanshu

      :confused:Hi all, I have a small problem..I have an MFC application..and I want to enable screensaver or disable screensaver on meeting some condition...can I do it..I tried searching for it in google, codeproject etc..but hard luck...nothing is there..can anyone out there help me out...any help or pointers are highly appreciated.. Thanks a lot in advance.. Himanshu

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      Do you want to disable it permanently or just while your program is running? To disable it permanently, you might have to write to the registry or use SystemParametersInfo(), although unless your program is specifically to change the screensaver, then most users won't like you doing this. To disable it temporarily, look at SetThreadExecutionState(ES_DISPLAYREQUIRED). This function is supported on Win98 or later. Hope this helps,

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      X 1 Reply Last reply
      0
      • R Ryan Binns

        Do you want to disable it permanently or just while your program is running? To disable it permanently, you might have to write to the registry or use SystemParametersInfo(), although unless your program is specifically to change the screensaver, then most users won't like you doing this. To disable it temporarily, look at SetThreadExecutionState(ES_DISPLAYREQUIRED). This function is supported on Win98 or later. Hope this helps,

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        X Offline
        X Offline
        xxhimanshu
        wrote on last edited by
        #3

        :confused::((Hi, Thanks..i tried using systemparametersinfo() but seems as if it is not enabling the screensaver..i want to enable screensaver like on event when I press OK button..but it is not happening...and disabling i dont require..sorry..I think it will automatically disable if we press any key or move mouse..Please help... Thanks in advance.. Himanshu

        R J 2 Replies Last reply
        0
        • X xxhimanshu

          :confused::((Hi, Thanks..i tried using systemparametersinfo() but seems as if it is not enabling the screensaver..i want to enable screensaver like on event when I press OK button..but it is not happening...and disabling i dont require..sorry..I think it will automatically disable if we press any key or move mouse..Please help... Thanks in advance.. Himanshu

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          Oh, you want to start the screensaver running whenever you like? A screensaver is just an exe file on your hard-drive. The name of the screensaver file the user has selected is in the registry, at "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE". Read this value and pass it to ShellExecute() and that will run the user's screensaver. Hope this helps,

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          R 1 Reply Last reply
          0
          • R Ryan Binns

            Oh, you want to start the screensaver running whenever you like? A screensaver is just an exe file on your hard-drive. The name of the screensaver file the user has selected is in the registry, at "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE". Read this value and pass it to ShellExecute() and that will run the user's screensaver. Hope this helps,

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            R Online
            R Online
            Rage
            wrote on last edited by
            #5

            Ryan Binns wrote: A screensaver is just an exe file on your hard-drive Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr. ~RaGE();

            R 1 Reply Last reply
            0
            • R Rage

              Ryan Binns wrote: A screensaver is just an exe file on your hard-drive Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr. ~RaGE();

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              Rage wrote: Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr. :rolleyes: Picky, picky, picky ;P. I know that!

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              R 1 Reply Last reply
              0
              • R Ryan Binns

                Rage wrote: Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr. :rolleyes: Picky, picky, picky ;P. I know that!

                Ryan

                "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                R Online
                R Online
                Rage
                wrote on last edited by
                #7

                Ryan Binns wrote: Picky, picky, picky :-D Hey, we are on CP here, the most *precise* web site about code stuff ... ;P ~RaGE();

                R 1 Reply Last reply
                0
                • R Rage

                  Ryan Binns wrote: Picky, picky, picky :-D Hey, we are on CP here, the most *precise* web site about code stuff ... ;P ~RaGE();

                  R Offline
                  R Offline
                  Ryan Binns
                  wrote on last edited by
                  #8

                  Rage wrote: Hey, we are on CP here, the most *precise* web site about code stuff :rolleyes: OK, so how about mentioning that a screensaver doesn't actually have to have a .scr extension. Any executable file can be used as a screensaver (heck, even .bat files work :rolleyes: ). You can even setup VC++ as your screensaver if you want to :) beat that!! ;P

                  Ryan

                  "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                  R 1 Reply Last reply
                  0
                  • R Ryan Binns

                    Rage wrote: Hey, we are on CP here, the most *precise* web site about code stuff :rolleyes: OK, so how about mentioning that a screensaver doesn't actually have to have a .scr extension. Any executable file can be used as a screensaver (heck, even .bat files work :rolleyes: ). You can even setup VC++ as your screensaver if you want to :) beat that!! ;P

                    Ryan

                    "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                    R Online
                    R Online
                    Rage
                    wrote on last edited by
                    #9

                    Ryan Binns wrote: beat that!! [ouch!] MMhhh ... well well well ... how is the weather in Australia today ;) ? ~RaGE();

                    R 1 Reply Last reply
                    0
                    • R Rage

                      Ryan Binns wrote: beat that!! [ouch!] MMhhh ... well well well ... how is the weather in Australia today ;) ? ~RaGE();

                      R Offline
                      R Offline
                      Ryan Binns
                      wrote on last edited by
                      #10

                      Rage wrote: [ouch!] I hope you saw the ";P". If not... ;P;P;P Rage wrote: how is the weather in Australia today The temperature is about 10 degrees, it's raining, and I'm hungry. I have no idea what colour the sky is because I can't see it - all I see is more clouds than there are people in New York, and I'm hungry. PS. Did I mention I was hungry? :rolleyes:

                      Ryan

                      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                      1 Reply Last reply
                      0
                      • X xxhimanshu

                        :confused::((Hi, Thanks..i tried using systemparametersinfo() but seems as if it is not enabling the screensaver..i want to enable screensaver like on event when I press OK button..but it is not happening...and disabling i dont require..sorry..I think it will automatically disable if we press any key or move mouse..Please help... Thanks in advance.. Himanshu

                        J Offline
                        J Offline
                        JT Anderson
                        wrote on last edited by
                        #11

                        If you want to start the currently configured screensaver, try this: PostMessage(GetForegroundWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0); -------- There are 10 types of people in this world. Those who know binary and those who don't.

                        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