469,350 Members | 1,736 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,350 developers. It's quick & easy.

How to catch CTRL +C key press

Dear all,

What is the best way to catch the user prressig the CTRL- C key combination..
I have try the keypress ans key down event but I am able only to catch one
key at a time ..

Amy idea ?

regard
serge
Nov 25 '06 #1
2 20524
In a WinForms app override the ProcessCmdKey:

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (msg.Msg)
{
case 0x100:
case 0x104:
switch (keyData)
{
case Keys.Control | Keys.C:
MessageBox.Show("Ctrl + C pressed");
break;
}
break;
}
return base.ProcessCmdKey(ref msg, keyData);
}

Gabriel Lozano-Morán
http://www.pointerx.net

"calderara" <ca*******@discussions.microsoft.comwrote in message
news:BA**********************************@microsof t.com...
Dear all,

What is the best way to catch the user prressig the CTRL- C key
combination..
I have try the keypress ans key down event but I am able only to catch one
key at a time ..

Amy idea ?

regard
serge
Nov 26 '06 #2
Hi Serge,

Actually, it can be done using the KeyDown event:

private void ctrl_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.C)
{
// TODO: Ctrl+C pressed in control
}
}

--
Dave Sexton

"calderara" <ca*******@discussions.microsoft.comwrote in message
news:BA**********************************@microsof t.com...
Dear all,

What is the best way to catch the user prressig the CTRL- C key
combination..
I have try the keypress ans key down event but I am able only to catch one
key at a time ..

Amy idea ?

regard
serge

Nov 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Alex Ostrikov | last post: by
3 posts views Thread by Greg | last post: by
6 posts views Thread by Paul Gorodyansky | last post: by
1 post views Thread by Claudiu Felecan | last post: by
3 posts views Thread by Glen Hong | last post: by
1 post views Thread by Jinsong | last post: by
1 post views Thread by iwdu15 | last post: by
5 posts views Thread by Samik R. | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.