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

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
 
T

Teis Draiby

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
 

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