In some of our GUIS we have enabled setScreenSaverEnabled and it works great!!!
However we discovered a hidden nasty side-effect
A bit of background
The ScreenSaverDefeater start a 10 seconds timeout that automatically simulates a shift key. If you have more than two languages, the behavior by default in Windows XP and Windows 7 if you press “CTRL” + “SHIFT” is to change the language. Therefore, if you keep the “CTRL” key down, and wait 10 seconds after calling setScreenSaverEnabled(false), the keyboard/language setup will change by itself. (This may be even nastier in WIndows XP when a WM_INPUTLANGCHANGEREQUEST is sent to the event loop, but lets not get side tracked).
The scenario is plausible if you imagine someone doing a lot of copy / paste…
To work around it, I have tried to replace the simulated shift key with a simulated mouse move of 0, i.e. :
I also tried
mouse_event( MOUSEEVENTF_MOVE, 1,0 , 0, NULL );
mouse_event( MOUSEEVENTF_MOVE, -1,0 , 0, NULL );
but the one with 0 seems fine too.
I was going to ask for your expert opinion if you can think of anything wrong with doing this instead of the shift key.
Thank you very much for your help and opinion