473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Programatically invoking KeyPress event from Form

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
Nov 16 '05 #1
5 8035
Rahul wrote:
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
Nov 16 '05 #2
Why not just use the operating system screen saver and set it to the time
you want ?

JIM
"Rahul" <ra********@yahoo.com> wrote in message
news:a5**************************@posting.google.c om...
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

Nov 16 '05 #3

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!
Nov 16 '05 #4


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!
Nov 16 '05 #5
Rahulan Madhavan wrote:
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
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Trevor Fairchild | last post by:
I'm writing a program that is designed for quick navigation using specific buttons on the keyboard. In doing this, I have added a KeyPress event for every control on the form to intercept the key...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
6
by: Niksa Baldun | last post by:
Hi, I am trying to capture data from magnetic stripe reader which is connected via keyboard interface (therefore indistinguishable from normal keyboard input). Basically, I am doing the...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
3
by: Nikolay Evseev | last post by:
Hi, I am trying to trace down the Enter key in my Form.KeyPress event handler. The KeyPreview property is set to false, so I'd assume that all key presses should go through my form's KeyPress...
3
by: Jake Barnes | last post by:
I'm researching the Enter key. This is for an Ajax chat application. The designer tells me that she wants people to be able to submit text simply by hitting the Enter key. She wants this to happen...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.