473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 21225
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alex Ostrikov | last post by:
I have console program, which runs infinite cycle in one thread. This thread makes output to stdout with System.out(). In main() I have: public static void main(String args) { // ... starting...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
6
by: Paul Gorodyansky | last post by:
Hi, Question about event.altKey event.ctrlKey event.shiftKey If I need to catch when a user does say Ctrl+Alt+G - somehow event.altKey is not working, i.e.:
1
by: Claudiu Felecan | last post by:
Anyone can help me how to catch CTRL-C? Thanks.
3
by: Glen Hong | last post by:
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab. Firstly, I can rap this when Ctrl-Tab is pressed however if I want to add an addition hotkey how can I distinguish between...
1
by: Jinsong | last post by:
Is there a way that I can catch the key press at page (form) level? I have a page with about 15 controls. but there is only one submit button. I want to do form submit when user press the enter...
1
by: iwdu15 | last post by:
hi, i was wondering how my form could catch key press events when its like minimized to the system tray? thanks -- -iwdu15
5
by: Samik R. | last post by:
Hello, Is there a way to catch CTRL+C key pressed by an user? Can someone point me to an example code block? Thanks. -Samik
2
by: thanhnh | last post by:
Hi. I have to write a simple Shell with History feature. First, I get a string from command line. The command line is split into tokens. And then, I call fork ( ) to create a new process. The child...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.