screensaver/monitor turns off when calling mouse_event

Answered screensaver/monitor turns off when calling mouse_event

  • Tuesday, June 05, 2007 3:23 PM
     
     
    Good day,

        I have a code that moves the cursor in a specified x and y coordinates. When I run it, sometimes the monitor turns off but sometimes it works normally. Tested it on a different PC , instead their screen saver turns on upon running the program. Does anybody know what is wrong?

    Thanks!

All Replies

  • Wednesday, June 06, 2007 1:02 AM
     
     Answered
    May be the screen saver is running when you have kept the system idle. More over do not use the mouse_event.This function has been superseded. Use SendInput instead. And when your program starts call the SystemParametersInfo with the SPI_SETBLOCKSENDINPUTRESETS, so that the screensaver will not be activated while your program is using the SendInput() function.
  • Wednesday, June 06, 2007 7:04 AM
     
     
    Thank you! So does that mean that everytime SendInput in used the screen saver will activate? I used SendInput to simulate a left click, when it triggers the screen saver also triggers.
  • Wednesday, June 06, 2007 11:37 AM
     
     

     lemonsito wrote:
    Thank you! So does that mean that everytime SendInput in used the screen saver will activate? I used SendInput to simulate a left click, when it triggers the screen saver also triggers.

     

    What will happen if you disable the screesaver and then run your program.

  • Wednesday, November 14, 2007 4:40 AM
     
     

    I've got the same/similar problem

     

    I'm using SendInput(mouse stuff) to simulate user input for testing of a program I am working on.

     

    if there is a screen saver enabled on the PC (XP,2003,Vista), then frequently the screen saver starts when I use SendInput - not after the screensaver timeout (which is 15mins) - and if power saving is enabled on the monitor, then the monitor also shuts off.

     

    it is happening within seconds of me starting that function of the program.

     

    I have tried adding

    SystemParametersInfo(SPI_SETBLOCKSENDINPUTRESETS,FALSE,NULL,FALSE);

     but no different.

     

    only current reliable workaround is to disable screen saver and monitor power saving.
  • Wednesday, November 14, 2007 4:47 AM
     
     
  • Thursday, September 13, 2012 7:47 AM
     
     

    I had exactly the same problem with my application - built with Delphi XE2 - with SendInput-function at XP, Win7 and Win8.

    Now, when I use ZeroMemory-function for tagINPUT-structure before feeding mouse xy-coordinates and flags to it, screen stays on normally. So weird..as far as I know Delphi should reset the memory area used beforehand. Thanks for the link!





    • Edited by Voimalla Thursday, September 20, 2012 4:46 PM
    • Edited by Voimalla Thursday, September 20, 2012 4:48 PM
    • Edited by Voimalla Thursday, September 20, 2012 4:48 PM
    • Edited by Voimalla Thursday, September 20, 2012 4:49 PM
    •