Click here to Skip to main content
14,695,505 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i have to implement the keyboard shortcuts in my application
if i do ctrl+c then my connect function should be call
could you please suggest me

What I have tried:

i have added in my .rc file
    POPUP "File"

MENUITEM "&Connect",                    ID_FILE_CONNECT


    "C",            ID_FILE_CONNECT,        VIRTKEY, CONTROL


im .cpp



could you please suggest me if anything is missed here
Updated 21-Jun-17 23:49pm
Richard MacCutchan 22-Jun-17 4:20am
What happens when you run the app and type Ctrl+C?

1 solution

Should work that way in general.

But Ctrl+C is the shortcut for ID_EDIT_COPY. If the focus is on a control that supports that shortcut, it will be handled by the control and not by the main frame window.

I suggest to select a shortcut that is not a general one (listed at Keyboard shortcuts for Windows[^]).

See also the topic "Provide consistent keyboard shortcuts" at Guidelines for Keyboard User Interface Design (Windows)[^]:
A consistent keyboard UI between applications helps users to learn and interact with new applications. An application must not affect any system-wide shortcut keys (a key or a combination of keys used to perform a command), such as the Windows logo key that opens the Start menu. An application must also follow commonly recognized shortcut key assignments, such as CTRL+C for Copy and CTRL+Z for Undo.
Member 13089825 22-Jun-17 8:58am
thank you jochen for your quick reply.
is it possible to implement own shortcuts(i mean override existing one with new one)
Jochen Arndt 22-Jun-17 9:29am
You can do that. But then you have to override it in all windows that handle the shortcut by default.

But again: I would not do so. It is breaking the usability guidelines (I will update my answer with a link).

Many users know that Ctrl+C is the shortcut to copy the actually selected data to the clipboard and will assume that an application handles it as expected. They might be irritated or annoyed if your application behaves differently.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900