Windows Constants for Ctrl+X, Ctrl+C, and Ctrl+V
Posted
by
Jonathan Wood
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Wood
Published on 2010-12-30T03:45:23Z
Indexed on
2010/12/30
3:54 UTC
Read the original article
Hit count: 367
I've got some older MFC code I wrote that I'm "freshening up" a bit. I have the following code in a window class' OnChar() handler.
I really don't like using constants like 0x18. I'd like to make the code more readable. I know I can declare my own, but are there no Windows macros for these values? I couldn't find anything about this on the web.
// Check for clipboard commands
switch (nChar)
{
case 0x18: // Ctrl+X - Cut
OnEditCut();
break;
case 0x03: // Ctrl+C - Copy
OnEditCopy();
break;
case 0x16: // Ctrl+V - Paste
OnEditPaste();
break;
}
© Stack Overflow or respective owner