We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I react to a Fn keypress at the form level ?

Thread ID:

Created:

Updated:

Platform:

Replies:

37191 Nov 17,2005 09:22 AM UTC Dec 16,2005 12:40 PM UTC WinForms 2
loading
Tags: FAQ
Gilbert Tordeur
Asked On November 17, 2005 09:22 AM UTC

I have implemented your answer "7.6 How can I listen for certain keys at the Form level irrespective of which Control has the focus?". Some keys are going to my code, but not all : the Fn keys, or a letter corresponding to a button shortcut do not go thru this routine. What can I do ? Thank you.

Gilbert Tordeur
Replied On November 17, 2005 10:47 AM UTC

Use KeyDown instead of KeyPress. >I have implemented your answer "7.6 How can I listen for certain keys at the Form level irrespective of which Control has the focus?". Some keys are going to my code, but not all : the Fn keys, or a letter corresponding to a button shortcut do not go thru this routine. What can I do ? Thank you.

Administrator [Syncfusion]
Replied On December 16, 2005 12:40 PM UTC

Hi Some other way using Win API declare fun like this [DllImport("User32.dll")] private static extern short GetAsyncKeyState( System.Int32 vKey); then u can use this code in timerelasped or inside a thread foreach(System.Int32 i in Enum.GetValues(typeof(Keys))){ if(GetAsyncKeyState(i) == -32767 && ActiveForm.Text=="") { MessageBox.Show(Enum.GetName(typeof(Keys), i)); } } this wil chk the key state.better place it in infinite loop. If u omit form.text check it will respond to the keypresses in other applns too.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;