Click here to Skip to main content
15,876,639 members
Home / Discussions / C#
   

C#

 
GeneralVss 6.0c Pin
sreejith ss nair22-Apr-04 2:14
sreejith ss nair22-Apr-04 2:14 
GeneralRe: Vss 6.0c Pin
Heath Stewart22-Apr-04 2:53
protectorHeath Stewart22-Apr-04 2:53 
GeneralRemote Debugging Pin
MrEyes22-Apr-04 1:53
MrEyes22-Apr-04 1:53 
GeneralRe: Remote Debugging Pin
Heath Stewart22-Apr-04 2:55
protectorHeath Stewart22-Apr-04 2:55 
GeneralRe: Remote Debugging Pin
Tom Larsen22-Apr-04 4:41
Tom Larsen22-Apr-04 4:41 
GeneralEvent in visual C# Pin
Hemant Mane22-Apr-04 0:57
Hemant Mane22-Apr-04 0:57 
GeneralRe: Event in visual C# Pin
A.Wegierski22-Apr-04 1:22
A.Wegierski22-Apr-04 1:22 
GeneralRe: Event in visual C# Pin
Heath Stewart22-Apr-04 2:59
protectorHeath Stewart22-Apr-04 2:59 
There's many ways of doing this. If you want to catch these in your derivative class, override OnKeyDown. External to your class, handle the KeyDown event. This is to catch and potentially "handle" the key without it being passed to the target window. If you don't care about stopping it from being dispatched, you can handle either KeyPress or KeyUp.

In there, you actually use the KeyEventArgs - not the EventArgs like the other response mentioned - to get the Keys enumeration member for pressed keys, or just the ASCII character value itself. See the documentation for the KeyEventArgs members for more details.

If you want to catch keys throughout your application (say, for configurable hot keys), implement the IMessageFilter class and add your implementing using Application.AddMessageFilter. You get a Message structure that contains the message (such as WM_KEYDOWN) and you can get the data from the WParam and LParam properties. You can also return true to signal that you've handled it and the message should not be dispatched.

 

Microsoft MVP, Visual C#
My Articles
Generalgraphics in c Pin
kcal22-Apr-04 0:09
kcal22-Apr-04 0:09 
GeneralRe: graphics in c Pin
Mazdak22-Apr-04 0:42
Mazdak22-Apr-04 0:42 
GeneralRe: graphics in c Pin
Dave Kreskowiak22-Apr-04 0:41
mveDave Kreskowiak22-Apr-04 0:41 
QuestionHow to use variable in property (attribute) Pin
A.Wegierski22-Apr-04 0:05
A.Wegierski22-Apr-04 0:05 
AnswerRe: How to use variable in property (attribute) Pin
Heath Stewart22-Apr-04 3:00
protectorHeath Stewart22-Apr-04 3:00 
AnswerRe: How to use variable in property (attribute) Pin
leppie22-Apr-04 7:12
leppie22-Apr-04 7:12 
AnswerRe: How to use variable in property (attribute) Pin
A.Wegierski22-Apr-04 19:42
A.Wegierski22-Apr-04 19:42 
GeneralExit statment in visual C# Pin
Hemant Mane21-Apr-04 23:54
Hemant Mane21-Apr-04 23:54 
GeneralRe: Exit statment in visual C# Pin
A.Wegierski22-Apr-04 0:19
A.Wegierski22-Apr-04 0:19 
GeneralRe: Exit statment in visual C# Pin
Heath Stewart22-Apr-04 3:01
protectorHeath Stewart22-Apr-04 3:01 
GeneralRe: Exit statment in visual C# Pin
A.Wegierski22-Apr-04 19:59
A.Wegierski22-Apr-04 19:59 
GeneralRe: Exit statment in visual C# Pin
SJ_Phoenix22-Apr-04 0:42
SJ_Phoenix22-Apr-04 0:42 
GeneralC++ Bit Fields implementation in C# Pin
Vini Deep21-Apr-04 23:33
Vini Deep21-Apr-04 23:33 
GeneralRe: C++ Bit Fields implementation in C# Pin
A.Wegierski22-Apr-04 1:10
A.Wegierski22-Apr-04 1:10 
GeneralRe: C++ Bit Fields implementation in C# Pin
Vini Deep22-Apr-04 1:31
Vini Deep22-Apr-04 1:31 
GeneralRe: C++ Bit Fields implementation in C# Pin
Member 363026618-Dec-08 19:53
Member 363026618-Dec-08 19:53 
GeneralRe: C++ Bit Fields implementation in C# Pin
Tim Kohler22-Apr-04 1:22
Tim Kohler22-Apr-04 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.