[win32] - how do a normaly alt key + letter key?

This is a discussion on [win32] - how do a normaly alt key + letter key? within the Windows Programming forums, part of the Platform Specific Boards category; heres my code for keyown: Code: static char altkey; static bool keypress=false; //................. case WM_KEYUP: //exit the program if(wParam==VK_ESCAPE) { ...

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    158

    [win32] - how do a normaly alt key + letter key?

    heres my code for keyown:

    Code:
    static char altkey;
        static bool keypress=false;
    
    //.................
    case WM_KEYUP:
                //exit the program
                if(wParam==VK_ESCAPE)
                {
                    DestroyWindow(hwnd);
                }
                keypress=false;
                return 0;
    case WM_KEYDOWN:
                if (KeyPressed(VK_MENU))
                {
                    if(KeyPressed(altkey) && keypress==false)
                    {
                        SendMessage(hwnd,WM_COMMAND,BN_CLICKED,0);
                        keypress=true;
                    }
                }
                return 0;
    i need these code works like the alt key combination, but seems that only works, when i press on that 2 keys in same time
    so how can i press alt+altkey without be in same time?
    (if the question is confused think on underline button caption letters('&'))

  2. #2
    Registered User
    Join Date
    Jun 2014
    Posts
    9
    Sorry i am confused, do you want to press eg <ctrl>-<alt>-<del> in a sequence instead of in one time stroke ? <ctrl> and <alt> as i remember them do not create standard key strokes but some extended codes. This forces you to read some other "register" to see if these are pressed or not, as they do not create code alone in "normal" keybuffer readings. Fair enough i might remember wrong :-).

  3. #3
    Registered User
    Join Date
    Aug 2013
    Posts
    158
    Quote Originally Posted by Romme View Post
    Sorry i am confused, do you want to press eg <ctrl>-<alt>-<del> in a sequence instead of in one time stroke ? <ctrl> and <alt> as i remember them do not create standard key strokes but some extended codes. This forces you to read some other "register" to see if these are pressed or not, as they do not create code alone in "normal" keybuffer readings. Fair enough i might remember wrong :-).
    the button caption is: "&hello"
    i need activate the alt + h(like you see in caption) for activate the mouse click

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 API, can it inFile and outFile, like Win32 console?
    By neutral87 in forum C++ Programming
    Replies: 0
    Last Post: 04-28-2013, 10:22 PM
  2. Win32 Console Application event handlers, or Win32 Project?
    By Joewbarber in forum C++ Programming
    Replies: 1
    Last Post: 03-29-2013, 08:02 AM
  3. Replies: 12
    Last Post: 11-24-2012, 04:10 AM
  4. How To Make Capital Letter To Small Capital Letter??
    By jason07 in forum C++ Programming
    Replies: 3
    Last Post: 10-10-2005, 05:37 PM
  5. Big Letter became small letter
    By cogeek in forum C Programming
    Replies: 27
    Last Post: 12-13-2004, 02:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21