screensaver problem
-
: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
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 atSetThreadExecutionState(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"
-
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 atSetThreadExecutionState(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"
: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
-
: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
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 toShellExecute()
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"
-
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 toShellExecute()
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"
-
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();
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"
-
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"
-
Ryan Binns wrote: Picky, picky, picky :-D Hey, we are on CP here, the most *precise* web site about code stuff ... ;P ~RaGE();
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"
-
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"
-
Ryan Binns wrote: beat that!! [ouch!] MMhhh ... well well well ... how is the weather in Australia today ;) ? ~RaGE();
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"
-
: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
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.