VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 关闭屏幕保护功能,改变屏保等待时间
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:14078, 日期:2001-11-24
关闭屏幕保护功能,改变屏保等待时间
作者:-
如何关闭ScreenSave功能, 改变Timeout时间

  此外希望只有本次使用 Windows 时改变(下次开机时还原原状), 则最後参数改为 SPIF_SENDWININICHANGE (没有SPIF_UPDATEINIFILE)

Const SPI_SETSCREENSAVEACTIVE = 17
Const SPI_SETSCREENSAVETIMEOUT = 15
Const SPIF_SENDWININICHANGE = &H2
Const SPIF_UPDATEINIFILE = &H1

Private Declare Function SystemParametersInfo Lib "user32" Alias _
  "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
   ByVal lpvParam As Long, ByVal fuWinIni As Long) As Long

Private Sub SetScreenSaveTimeout(ByVal BySecond As Long)
 Call SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, BySecond, 0, _
     SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE)
End Sub

Private Sub EnableScreenSave()
 Call SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, 0, _
     SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE)
End Sub
Private Sub DisableScreenSave()
 Call SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, _
     SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE)
End Sub