Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / November 2006

Tip: Looking for answers? Try searching our database.

How to catch CTRL +C key press

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
calderara - 25 Nov 2006 20:04 GMT
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
Gabriel Lozano-Morán - 26 Nov 2006 15:36 GMT
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

> Dear all,
>
[quoted text clipped - 7 lines]
> regard
> serge
Dave Sexton - 27 Nov 2006 04:31 GMT
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
   }
}

Signature

Dave Sexton

> Dear all,
>
[quoted text clipped - 7 lines]
> regard
> serge

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.