I am trying to create a keyboard or mouse event in windows using vb, timed to recreate every minute or so. I was able to do this using the timer control and sendkeys function, and it works, but not with the results i was looking for. I need to actuallly imitate a real keypress or mouse click. To better understand what I need - i want to reproduce a mouse movement or keypress to prevent windows from initiating the screen saver. I actually want to run this on a desktop that I access through terminal services...the session will timeout if it detects inactivity after 1 minute or so, which is a real pain...the admin on this machine hasn't seen fit to fix this (or doesn't know how) and i don't have permission to change it myself, so i am hoping to write this little vb app that creates a timed keyboard mouse event at the hardware level.
Probably a mouse even (a movement of one pixel should do it) would probably better, this way the program can run in the background and wouldn't interfere when someone is actually using the machine (ie, unexpected keyboard output!)
i think i might have found what i am looking for - at least for keyboard events. i tested it locally and it worked - stopped my screen saver from coming on. i am testing it on the remote desktop now...its hard to say if it will work there because i don't fully understand how terminal services handles keyboard events remotely...
i found the code here: http://www.developerfusion.com/show/274/
i don't know if i need the mouse event because i am emulating the control key, which should have no adverse effects when someone is actually using the remote desktop..i hope!
i would love feedback. thanks
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center