Re: HMENU Hotkeys & Icons
1. Format the shortcut in the option of your menu, so that it is placed to the right side by inserting a tab character, "\t", just before the shortcut, e.g.
Code:
AppendMenu(hMenu, MF_STRING | MF_ENABLED, (UINT) (215), "&Copy\tCtrl+C");
The ampersand character is another way to have a shortcut, but it works for one character only, e.g. "C" not "Ctrl+C".
Then, in your code, you will have to manage Ctrl+C, e.g.
Code:
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* Handle the messages */
{
...
case WM_CHAR:
switch (wParam) {
case (WPARAM) (3): // ctrl C
PostMessage(hwnd, WM_COMMAND, 215, 0L); // redirect to my copy option
break;
case (WPARAM) (22): // ctrl V
...
break;
case (WPARAM) (24): // ctrl X
...
break;
case (WPARAM) (26): // ctrl Z
...
break;
}
break;
case WM_COMMAND:
switch(wParam) {
case 215: // Copy to clipboard
...
break;
...
}
Re: HMENU Hotkeys & Icons
Thanks olivthill2, that worked like a charm!
Now if someone could help me with problem #2...