![]() |
Disabling Screensaver
This might be a little far fetched but I would like to
know how if it is possible to make my VBA program disable the windows screensaver at the beginning of execution and then enable it at the end. The reason is that the program seems to error out when the screensaver comes on. Jeff |
Disabling Screensaver
This nice little API function from Don Bradner seems to do the trick:
Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub -- Vasant "Jeff Armstrong" wrote in message ... This might be a little far fetched but I would like to know how if it is possible to make my VBA program disable the windows screensaver at the beginning of execution and then enable it at the end. The reason is that the program seems to error out when the screensaver comes on. Jeff |
All times are GMT +1. The time now is 10:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com