Sign in to follow this  
Pet123

how to receive Ctrl-C message

Recommended Posts

hi all : i can easily receive Ctrl-X (cut), Ctrl_C (Paste) notify via WM_CHAR message in a program created with UNICODE defined, but why i can not receive them no more when the same program compiled without UNICODE defined? thanks.

Share this post


Link to post
Share on other sites
Are these characters part of the ASCII set? They might not be, and if they aren't, they can't come in a single message. You can, however, catch presses of ctrl and c seperatly.

Share this post


Link to post
Share on other sites
The better solution is probably to use accelerators. You will then generate separate messages (ID_COPY, ID_PASTE, everything you want).

If you don't want to do that, you can test your character key in the WM_CHAR handler, then call GetAsyncKeyState(VK_CONTROL) to know wether the control key is up or down.

As MSDN states :

Quote:

The TranslateMessage function generates a WM_CHAR message when the user presses any of the following keys:

  • Any character key
  • BACKSPACE
  • ENTER (carriage return)
  • ESC
  • SHIFT+ENTER (linefeed)
  • TAB



HTH,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this