473,657 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to trap "ctl + c" in key up event

I writing a WPF windows app in c# and want to determine if the user has
pressed the control key and the 'c' key at the same time similar to the
standard windows 'copy' shortcut keys. How would I go about this?

Thanks.

--
mo*******@noema il.noemail
Feb 28 '07 #1
2 1634
Hi,

Thank you for posting here.

This is a quick note to let you know that I am researching on this issue
and will get back to you ASAP. I appreciate your patience.
Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 28 '07 #2
Hi,

Sorry for my delayed response.

To determine if the user has pressed the control key and the 'c' key at the
same time on a WPF window, we could subscribe the KeyDown event of the
window and check the pressed keys in the event handler.

The following is a sample.
public partial class Window1 : System.Windows. Window
{

public Window1()
{
InitializeCompo nent();
this.KeyDown += new KeyEventHandler (Window1_KeyDow n);
}

void Window1_KeyDown (object sender, KeyEventArgs e)
{
if (e.KeyboardDevi ce.Modifiers == ModifierKeys.Co ntrol && e.Key
== Key.C)
{
MessageBox.Show ("You have pressed Ctrl+C.");
}
}
}

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Mar 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1253
by: Kelly G. | last post by:
This question is regarding the setup, Is it possible to catch the event of the close button in the installation complete windows form dialog control(finished) , I basically need to point to a website(for registeration) after the user clicks the close button. Also is there any alternative method possible (I dont want to use the
13
1822
by: MLH | last post by:
I'm thinking that maybe error trapping code could be in a global module (standard procedure) and a Master "OnError" statement could be set. Is anything like this in use with VBA for A97?
1
3219
by: Sean Nolan | last post by:
We have implemented unhandled error trapping at the application level and log these errors to our database. One error, however, the does not get trapped is when the connection pool has exceeded the max number of connections. Obviously, we need to find the place(s) in our code where connections are not closed correctly (espcially in loops), but I'm wondering if it's possible to trap this error and to find out which part of our code (i.e....
4
1273
by: Lars Netzel | last post by:
Is there any way to add some code that will happen in every single Event that i raised in a form? I have a Total field in the bottom of a pretty complex page and I think it's kind of "Dirty" to update that Filed from every single Event that might affect it Is there are was to keep that Filed Total (a value) updated at all time without having to think about it in every single event on the page?
3
1812
by: Dale | last post by:
Access 2000 I am trying to check the form to be sure that required fields are entered. For each required field (Control) I have set the tag property to "1". I am trying to loop through all controls with a tag property of "1", If they are null, I want to stop the loop and setfocus on the control. The below code works Except it will not stop looping when a control is null. It will display the msgBox and then continue to the next...
1
3292
by: Anjan Bhowmik | last post by:
I am getting this exception while binding data to Gridview. I have a control parameter that accepts a integer value from a TextBox. If i provide a invalid value, i get that exception. But can't handle it anywhere. I tried the ObjectDataSource's Selecting method handler, but failed. How do i cath those exceptions befor they rise? And Can you please provide me a link that explains the "Event Mechanism" in details, so that i gain acurate...
0
876
by: =?Utf-8?B?QWFyb24=?= | last post by:
I want to create an alert to trap event Id 55 and 2000 by MOM. We have MOM 2005 with sql 2000 sp4. Could someone give me some advice how to create this - Aaron
1
2499
by: atishrg | last post by:
Hello all, I am facing a problem,, that I am not able to trace a "OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT" EXCEPTION .... as I am using On error goto _Lable as soon as this exception occures control directly shifted to error lable I want to excute next line even if this exception occures... Can Any one help to do this Atish
1
1804
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
I have a assembly from a third party that exposes an Event I want to Trap the event and tie to a Method in a Class where I am consuming their assembly. The class is actually a UserControl How can I tie OnSettingsModified from the assembly to Method Configuration_OnValid in my class ???? Thanks
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.