Results 1 to 2 of 2

Thread: Disable screensaver

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    7

    Talking

    Does anyone know how to disable the screensaver (using API or whatever)in VB 6(Not using DisablePro32.ocx either)

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217

    Smile

    Sure do, try the following:
    Code:
    '<<< CONSTANTS >>>
    Private Const SPI_SETSCREENSAVEACTIVE As Long = 17
    
    Private Const SPIF_UPDATEINIFILE = &H1
    Private Const SPIF_SENDWININICHANGE = &H2
    
    
    '<<< DECLARES >>>
    Private Declare Function SystemParametersInfo _
                    Lib "user32" _
                    Alias "SystemParametersInfoA" _
                    (ByVal uAction As Long, ByVal uParam As Long, _
                    ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
    Then call like this:
    Code:
       Dim lRet As Long
       Dim lCBool As Long
       
       lCBool = 0
       lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lCBool, ByVal 0, SPIF_UPDATEINIFILE)
    Set lCBool to 0 (zero) to de-activate the screen saver, and set it to a nonzero value to re-activate the screen saver. Make sure if you de-activate the screen saver that you re-activate it before your program terminates, otherwise the screen saver will act buggy. Play with it yourself it see what I mean.

    Later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width