Vista and Monitor Power Saving
Blitz3D Forums/Blitz3D Programming/Vista and Monitor Power Saving
| ||
How can i prevent vista to go in to powersave mode (turn the monitor off) when i play my blitz3d game with a joystick? There is no problem if i play the game with the keyboard. Henrik |
| ||
Shouldn't joystick activity prevent "power saving" or wake up the pc/monitor from sleep,like a keyhit or mouse activity/mouse button hit does? Henrik |
| ||
Maybe you could use an API call to fake a keypress every thirty seconds when the game is active ? |
| ||
Good idea, if i only knew how to do that ;) |
| ||
I'm not sure if this will work under Vista. First of all, create a file that is called "user32.decls", and place it in c:\program files\blitz3d\userlibs Put these lines in that file: .lib "user32.dll" api_keybd_event%(bVk%, bScan%, dwFlags%, dwExtraInfo%) : "keybd_event" After that you can use the command api_keybd_event() in your programs. This code will press the key "A". Note that you should not only press the key, but also release it afterwards. Repeat api_keybd_event($41, 0, 0, 0) ;keydown api_keybd_event($41, 0, 2, 0) ;keyup Delay 2500 Until KeyHit(1) End First open notepad, then start the code, then switch to notepad. Every 2.5 seconds, it will press the 'A' key. For more info on keybd_event, look here: http://msdn.microsoft.com/en-us/library/ms646304(VS.85).aspx |
| ||
Wait, I found something else that might work better: http://www.blitzbasic.com/Community/posts.php?topic=67312 |
| ||
I will try that, thanks a lot for your help. Henrik |
| ||
I use the API call to fake a keypress, and it works great! Thanks again Warner. Henrik |