Results 1 to 6 of 6

Thread: Stop A Running Screen Saver Programmatically !

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Stop A Running Screen Saver Programmatically !

    Hi all,

    I am running a lenghthy loop and I want to PREVENT the screen saver from running during the time the loop is being excecuted.

    I can detect when the screen saver kicks off but I can't seem to disable it as soon as that happens.

    I have tried many things including SendKeys and Mouse move evnts, setcursorPos ....to emulate an action but without any luck !

    this is waht I have so far but the "SPI_SETSCREENSAVERRUNNING" doesn't work !

    Code:

    VB Code:
    1. Declare Function SystemParametersInfo Lib "user32" Alias _
    2. "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
    3. ByRef lpvParam As Long, ByVal fuWinIni As Long) As Long
    4.  
    5. Const SPI_SETSCREENSAVERRUNNING As Long = 97
    6. Const SPI_GETSCREENSAVERRUNNING As Long = &H72
    7.  
    8. Public Sub TEST()
    9.  
    10.     Dim lngIsRunning As Long
    11.    
    12.     Do
    13.         SystemParametersInfo SPI_GETSCREENSAVERRUNNING, vbNull, lngIsRunning, vbNull
    14.         If CBool(lngIsRunning) Then
    15.             'THIS DOESN'T DISABLE SCREEN SAVER !
    16.             SystemParametersInfo SPI_SETSCREENSAVERRUNNING, 0, 0, 0
    17.             Exit Do
    18.         End If
    19.     Loop
    20.     MsgBox "FINISH"
    21.  
    22. End Sub

    I have even used different SenMessage commands but nothing disables the screen saver !


    FYI, I am using WIN XP.

    ANY HELP PLEASE ?

    THANK YOU.

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Stop A Running Screen Saver Programmatically !



    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Stop A Running Screen Saver Programmatically !

    Thanks Manavo but that link doesn't answer my question

    I don't want to install or uninstall a screensaver, I want to unload it as soon as it kicks off just like when the mouse is moved or a key pressed by the user.

    I hope I have explained this clearly.

    FYI, emulating a mouse move via the mouse_event or SetCursorPos APIs or even SendKey don't seem to work !

    Anyone has a solution to this one ?

    Regards.

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Stop A Running Screen Saver Programmatically !

    What version of windows are you running? I had tried sending an "enter" press on Win XP Pro with sendkeys and it worked


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: Stop A Running Screen Saver Programmatically !

    Try api SendInput() to emulate keystroke.

  6. #6
    Addicted Member
    Join Date
    Feb 2006
    Location
    Hyderabad, India
    Posts
    233

    Re: Stop A Running Screen Saver Programmatically !

    May be I am being naive here. But what wait till the screen saver starts off? How about putting a timer with an interval of 5 minutes or so and simulating shift press and delete or may be even mousemove.

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