Click here to Skip to main content
12,949,601 members (67,206 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hey , everyone, I have a question about ctrl key, now I created a vc demo, i changed Toolbar to Ooobal with shortcut key O, if the view main-menu has pop up, it will response either you press o keypad or Ctrl+O combination keypad, and the ctrl+o is used in file main-menu, if not used, press ctrl+o is not responsed. Now, I want only o letter has a response, not ctrl+o, even if the ctrl+o is used in other sub-menu item.
The windows default demo all like this, I found that the foxit reader did not like this, it’s OK. I want how they did it?

Anyone understand it? If u know, please reply the questions.
thank you very much
Posted 9-Feb-12 19:45pm
SAKryukov 10-Feb-12 2:47am
There are many ways to screw up thing. Now do we know which one is your favorite?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

By default "Normal" keys like A to Z do not open menus, they type characters. That is why the modifier keys like CTRL and ALT exist - so that applications can tell what the user is trying to do.

If you did successfully subvert this, all you would do in practice is annoy the heck out of your users.

Do not do this, it is a stupid idea. Stick to CTRL+key or ALT+key combinations instead.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

hi, OriginalGriff,
The customer want only "Normal" keys as short-key separately, not with CTRL key for serval short-keys, as my mentioned, The foxit reader software can support this. I capture WM_COMMAND message in mainfrm::PreTranslateMessage, get the top-level menu id, gonna simulate left-clicking of the mouse ,but has no respose, the codes as belows,

if (pMsg->message == WM_COMMAND)
        if (ID_ZOOMIN == LOWORD(pMsg->wParam))
            if (::GetKeyState(VK_CONTROL) < 0)
                if (m_pMainMenu)
                    UINT n = m_pMainMenu->gt;GetMenuItemID(1);
                    ::SendMessage((HWND)m_pMainMenu->GetSubMenu(1)->gt,GetSafeHmenu(),WM_COMMAND,MAKEWPARAM(0, m_pMainMenu->GetMenuItemID(1)),0);
                return TRUE;


the ID_ZOOMIN is the sub-menu ID which short-key is "O". Now the before codes can forbid the ctrl+o keypad, but if press ctrl+o, this sub-menu has disappeared, lost focus. I am finding the reason.
Could OriginalGriff or anyboy tell me the reason or the other approach to finish this little funtion?

waiting the reply

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,489
CHill60 3,380
Maciej Los 2,913
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web01 | 2.8.170524.1 | Last Updated 13 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100