I need to capture the "Ctrl+F4" in widows application

  • Thread starter Thread starter karunakar
  • Start date Start date
K

karunakar

Hi all

Just i want capture the with "Ctrl" (Key bord function) + any F1 or F4

In windows application How can capture the event in C# .net

Regards,
Venu
 
Put this inside your Form class:

--<code>------------------------------------
protected override bool ProcessDialogKey(Keys keyData)
{
switch (keyData)
{
case (Keys.Control | Keys.F4):
MessageBox.Show("You pressed Crtl-F4");
return true; // Tell the caller that the key has been handled
case (Keys.Control | Keys.F1):
MessageBox.Show("You pressed Crtl-F1");
return true;
};
// If the key hasn't been used by you then pass it to the base class
return base.ProcessDialogKey(keyData);
}
--<end code>------------------------------------

More reading here:
http://www.ondotnet.com/pub/a/dotnet/2002/04/29/keys.html

regards, Teis
 
Back
Top