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

Raising keyboard events

P: n/a
DC
Hi All,

Is there any code snippet that shows how to raise keyboard events,
for example,
simulating the KEYDOWN event on key F5.

Thanks,
DC
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Take a look at the sendkeys class
http://msdn.microsoft.com/library/de...classtopic.asp

Ken
------------------------------
"DC" <an**@anonymous.com> wrote in message
news:uS****************@TK2MSFTNGP12.phx.gbl...
Hi All,

Is there any code snippet that shows how to raise keyboard events,
for example,
simulating the KEYDOWN event on key F5.

Thanks,
DC

Nov 21 '05 #2

P: n/a
DC
Thanks Ken.
The way I had been doing it is as follows:

Dim keyData As System.Windows.Forms.Keys
keyData = Keys.F5

Dim keyEvent As System.Windows.Forms.KeyEventArgs
keyEvent = New System.Windows.Forms.KeyEventArgs(keyData)

RaiseEvent PressKeyDown(Me, keyEvent)

What do you think of this? This works ( I have a form.keydown event
handler), but I would appreciate your comments.

Regards,
DC


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
Hi,

Take a look at the sendkeys class
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
------------------------------
"DC" <an**@anonymous.com> wrote in message
news:uS****************@TK2MSFTNGP12.phx.gbl...
Hi All,

Is there any code snippet that shows how to raise keyboard events,
for example,
simulating the KEYDOWN event on key F5.

Thanks,
DC

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.