By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

need to design code to frequently simulate key press every 30/45 secs

P: 2
Hi Every body there,

I need to write a Vb code, so that it could simulate the keyboard press every 30 secs/45 secs untill some time desiganted.

I have tried using API, with sendkeys, tried some .exe file "no sleep" however not of any help, the send keys actually sends the command may be but it doesnt get registers, hence any idea on putting this keyboard press solve.

Thanks
Bivin
Oct 21 '13 #1
Share this Question
Share on Google+
4 Replies


pod
100+
P: 298
pod
May I ask why you need to simulate a keyboard press?
Oct 21 '13 #2

!NoItAll
100+
P: 296
Sendkeys is how it is done. You will, however need to make sure the keystrokes are being sent to the application where you want them to go - otherwise they will simply be executed on the application that currently has focus on the Windows desktop. This is very tricky and fraught with peril. You will need to PInvoke some Win32 APIs to find the window you want, validate it and then set it to have focus before you use sendkeys. You should do it before EVERY keystroke.
You should be rolling your eyes about now and saying: Wow, this is a bad idea...
Oct 23 '13 #3

P: 2
problem i am facing is, i work on three and more systems simultaneously and this causes each machine un attended for 5-10 mins and causes auto lock, however i have created code to avoid the auto lock by frequently sending send keys, but my real problem is the system registers only the last actual key press and this causes me penalty on my time utilisation captured, hence cutting long story short i need code which performs actual key press of keyboard or mouse but via code.

Hope i have cleared by request.
Oct 25 '13 #4

Rabbit
Expert Mod 10K+
P: 12,382
I'm not sure that we can answer this. This sounds like a huge security concern. The reason the computer auto locks is so that in case someone forgets to manually lock it when they step away, there's a smaller time period for someone else to come along and use the computer. We do not help people bypass security like this.
Oct 25 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.