Programatically invoking KeyPress event from Form

R

Rahul

Hi,
Am working with a windows application where I need to show am
application screen saver after 1 of system idle state, and its working
fine if there is no Key board input or Mouse input.
But the problem is i have to scan a barcode and display the details on
the form.But OS is not resognising scanner input as last input (I am
using GetLastInputInfo(),and GetTicks() for calculating systemidle
time)

So I descided to raise a keypress Event while scanning.
I am using "this.OnKeyPress((char)65)" for this.
But it seems that system is not recoginising this as a key press
event.
Can anubody tell the reason? Any other approaches also welcome.

rgds
Rahul
 
A

Arne Janning

Rahul said:
Am working with a windows application where I need to show am
application screen saver after 1 of system idle state, and its working
fine if there is no Key board input or Mouse input.
But the problem is i have to scan a barcode and display the details on
the form.But OS is not resognising scanner input as last input (I am
using GetLastInputInfo(),and GetTicks() for calculating systemidle
time)

So I descided to raise a keypress Event while scanning.
I am using "this.OnKeyPress((char)65)" for this.
But it seems that system is not recoginising this as a key press
event.
Can anubody tell the reason? Any other approaches also welcome.

Hi Rahul,

Shouldn't it be:
this.OnKeyPress(new KeyPressEventArgs((char) 65)); ?

Cheers

Arne Janning
 
J

james

Why not just use the operating system screen saver and set it to the time
you want ?

JIM
 
R

Rahulan Madhavan

Hi Jim,
The requirement is to show our own screen saver with custom text.This
part is working fine. Only problem is OS in not recognizing the scann
event as I am using GetLastInputInfo().

rgds
Rahul

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
R

Rahulan Madhavan

Hi Arne,
Thanks for the correction.But will "((char) 65))" the ASCII value of the
key "A"? As KeyPressEventArgs(char keyChar - ASCII char value of the key
pressed)

rgds
Rahul


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
A

Arne Janning

Rahulan said:
Hi Arne,
Thanks for the correction.But will "((char) 65))" the ASCII value of the
key "A"? As KeyPressEventArgs(char keyChar - ASCII char value of the key
pressed)

Why not simply use "A"?

Cheers

Arne Janning
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top