-
Screensaver timeout value query
If I change the Timeout value in the registry for my ScreenSaver using VB
the system only seem to become aware of the new value the next time I log
on.
If I change this in Control Panel it appears to take affect immediately.
I know for environment variable changes I can use something along the lines
of
SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, & _
0, "Environment", SMTO_ABORTIFHUNG, 5000, dwReturnValue
This however does not appear to refresh the screensaver settings which are
stored in. "HKEY_CURRENT_USER\Control Panel\Desktop\NoDispScrSavPage"
Does anyone know how to alert the system of this change.
Rgds
Ben
-
Re: Screensaver timeout value query
You can do it all with one call to the SystemParametersInfo Api
function instead. It handles reading/writing to the registry and
applies the changes immediately.
Public Const SPI_GETSCREENSAVETIMEOUT = 14
Public Const SPI_SETSCREENSAVETIMEOUT = 15
Public Const SPIF_UPDATEINIFILE = &H1
Public Const SPIF_SENDWININICHANGE = &H2
Public Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, ByVal uParam As Long, _
lpvParam As Any, ByVal fuWinIni As Long) As Long
'change timeout to 3 mins...
SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, 180&, _
ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE
'retreive current setting...
Dim lSecs As Long
SystemParametersInfo SPI_GETSCREENSAVETIMEOUT, 0&, lSecs, 0&
Debug.Print "current SS timeout=" & lSecs \ 60 & " min"
On Tue, 20 Mar 2001 23:49:18 -0500, "Ben Neville"
<bneville@programmer.net> wrote:
>If I change the Timeout value in the registry for my ScreenSaver using VB
>the system only seem to become aware of the new value the next time I log
>on.
>
>If I change this in Control Panel it appears to take affect immediately.
>
>I know for environment variable changes I can use something along the lines
>of
>SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, & _
>0, "Environment", SMTO_ABORTIFHUNG, 5000, dwReturnValue
>
>This however does not appear to refresh the screensaver settings which are
>stored in. "HKEY_CURRENT_USER\Control Panel\Desktop\NoDispScrSavPage"
>
>Does anyone know how to alert the system of this change.
>
>Rgds
>Ben
>
>
>
>
>
-Tom
(please post replies to the newsgroup)
-
Re: Screensaver timeout value query
You can do it all with one call to the SystemParametersInfo Api
function instead. It handles reading/writing to the registry and
applies the changes immediately.
Public Const SPI_GETSCREENSAVETIMEOUT = 14
Public Const SPI_SETSCREENSAVETIMEOUT = 15
Public Const SPIF_UPDATEINIFILE = &H1
Public Const SPIF_SENDWININICHANGE = &H2
Public Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, ByVal uParam As Long, _
lpvParam As Any, ByVal fuWinIni As Long) As Long
'change timeout to 3 mins...
SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, 180&, _
ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE
'retreive current setting...
Dim lSecs As Long
SystemParametersInfo SPI_GETSCREENSAVETIMEOUT, 0&, lSecs, 0&
Debug.Print "current SS timeout=" & lSecs \ 60 & " min"
On Tue, 20 Mar 2001 23:49:18 -0500, "Ben Neville"
<bneville@programmer.net> wrote:
>If I change the Timeout value in the registry for my ScreenSaver using VB
>the system only seem to become aware of the new value the next time I log
>on.
>
>If I change this in Control Panel it appears to take affect immediately.
>
>I know for environment variable changes I can use something along the lines
>of
>SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, & _
>0, "Environment", SMTO_ABORTIFHUNG, 5000, dwReturnValue
>
>This however does not appear to refresh the screensaver settings which are
>stored in. "HKEY_CURRENT_USER\Control Panel\Desktop\NoDispScrSavPage"
>
>Does anyone know how to alert the system of this change.
>
>Rgds
>Ben
>
>
>
>
>
-Tom
(please post replies to the newsgroup)
-
Re: Screensaver timeout value query
Thanks Tom that worked well.
"Tom Esh" <tjeshGibberish@blazenet.net> wrote in message
news:3ab86191.14094085@news.devx.com...
> You can do it all with one call to the SystemParametersInfo Api
> function instead. It handles reading/writing to the registry and
> applies the changes immediately.
>
> Public Const SPI_GETSCREENSAVETIMEOUT = 14
> Public Const SPI_SETSCREENSAVETIMEOUT = 15
> Public Const SPIF_UPDATEINIFILE = &H1
> Public Const SPIF_SENDWININICHANGE = &H2
> Public Declare Function SystemParametersInfo Lib "user32" _
> Alias "SystemParametersInfoA" _
> (ByVal uAction As Long, ByVal uParam As Long, _
> lpvParam As Any, ByVal fuWinIni As Long) As Long
>
> 'change timeout to 3 mins...
> SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, 180&, _
> ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE
>
> 'retreive current setting...
> Dim lSecs As Long
> SystemParametersInfo SPI_GETSCREENSAVETIMEOUT, 0&, lSecs, 0&
> Debug.Print "current SS timeout=" & lSecs \ 60 & " min"
>
> On Tue, 20 Mar 2001 23:49:18 -0500, "Ben Neville"
> <bneville@programmer.net> wrote:
>
> >If I change the Timeout value in the registry for my ScreenSaver using VB
> >the system only seem to become aware of the new value the next time I log
> >on.
> >
> >If I change this in Control Panel it appears to take affect immediately.
> >
> >I know for environment variable changes I can use something along the
lines
> >of
> >SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, & _
> >0, "Environment", SMTO_ABORTIFHUNG, 5000, dwReturnValue
> >
> >This however does not appear to refresh the screensaver settings which
are
> >stored in. "HKEY_CURRENT_USER\Control Panel\Desktop\NoDispScrSavPage"
> >
> >Does anyone know how to alert the system of this change.
> >
> >Rgds
> >Ben
> >
> >
> >
> >
> >
>
>
> -Tom
> (please post replies to the newsgroup)
-
Re: Screensaver timeout value query
Thanks Tom that worked well.
"Tom Esh" <tjeshGibberish@blazenet.net> wrote in message
news:3ab86191.14094085@news.devx.com...
> You can do it all with one call to the SystemParametersInfo Api
> function instead. It handles reading/writing to the registry and
> applies the changes immediately.
>
> Public Const SPI_GETSCREENSAVETIMEOUT = 14
> Public Const SPI_SETSCREENSAVETIMEOUT = 15
> Public Const SPIF_UPDATEINIFILE = &H1
> Public Const SPIF_SENDWININICHANGE = &H2
> Public Declare Function SystemParametersInfo Lib "user32" _
> Alias "SystemParametersInfoA" _
> (ByVal uAction As Long, ByVal uParam As Long, _
> lpvParam As Any, ByVal fuWinIni As Long) As Long
>
> 'change timeout to 3 mins...
> SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, 180&, _
> ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE
>
> 'retreive current setting...
> Dim lSecs As Long
> SystemParametersInfo SPI_GETSCREENSAVETIMEOUT, 0&, lSecs, 0&
> Debug.Print "current SS timeout=" & lSecs \ 60 & " min"
>
> On Tue, 20 Mar 2001 23:49:18 -0500, "Ben Neville"
> <bneville@programmer.net> wrote:
>
> >If I change the Timeout value in the registry for my ScreenSaver using VB
> >the system only seem to become aware of the new value the next time I log
> >on.
> >
> >If I change this in Control Panel it appears to take affect immediately.
> >
> >I know for environment variable changes I can use something along the
lines
> >of
> >SendMessageTimeout HWND_BROADCAST, WM_SETTINGCHANGE, & _
> >0, "Environment", SMTO_ABORTIFHUNG, 5000, dwReturnValue
> >
> >This however does not appear to refresh the screensaver settings which
are
> >stored in. "HKEY_CURRENT_USER\Control Panel\Desktop\NoDispScrSavPage"
> >
> >Does anyone know how to alert the system of this change.
> >
> >Rgds
> >Ben
> >
> >
> >
> >
> >
>
>
> -Tom
> (please post replies to the newsgroup)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks