Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC
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
bianqk658
Comments
SAKryukov at 10-Feb-12 2:47am
   
There are many ways to screw up thing. Now do we know which one is your favorite?
--SA
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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?
 
thanks,
waiting the reply
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 547
1 ChauhanAjay 180
2 CHill60 135
3 Maciej Los 125
4 Richard Deeming 125
0 Sergey Alexandrovich Kryukov 9,735
1 OriginalGriff 6,987
2 CPallini 5,835
3 George Jonsson 4,017
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 13 Feb 2012
Copyright © CodeProject, 1999-2014
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