Results 1 to 9 of 9

Thread: WinAPI WM_KEYDOWN how to detect Alt of left

  1. #1

    WinAPI WM_KEYDOWN how to detect Alt of left

    Hello

    I'm using WinAPI...

    Code:
    wm_keydown:
    begin
    
    
        if &#40;GetKeyState&#40;&#40;VK_MENU&#41;&#41; <> 0&#41; and &#40;wParam = VK_RETURN&#41; then
        begin      
       //code here
        end;
    how to detect the alt of left?

    i tried VK_LMENU but dont get sucess...

    suggestions?

    Greetings
    Knowledge is power.

  2. #2

    WinAPI WM_KEYDOWN how to detect Alt of left

    on wm_keydown call GetKeyboardState and figure out which key was pressed / depressed from that structure.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3

    WinAPI WM_KEYDOWN how to detect Alt of left

    http://www.delphifaq.com/faq/delphi_...API/f359.shtml

    VK_MENU should be the alt. Also available in L and R version.
    http://3das.noeska.com - create adventure games without programming

  4. #4

    WinAPI WM_KEYDOWN how to detect Alt of left

    You may check the value of lParam. Especially the following bits:
    16-23 - Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
    24 - Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

  5. #5

    WinAPI WM_KEYDOWN how to detect Alt of left

    I've changed to this:

    If (GetAsyncKeyState ((VK_SHIFT)) <> 0) and (Key = VK_RETURN) then

    and is working...

    the problem is not with VK_LMENU...

    the problem is when i press Alt of Left on my windowed window.. it set focus to windows properties... such as a submenu..

    how to disable this "option" on a Window with pure WinAPI?

    doing this i will get the desired result..

    suggestions?
    Knowledge is power.

  6. #6

    WinAPI WM_KEYDOWN how to detect Alt of left

    So, why are you all ignoring the GetKeyboardState solution? that thing gives you a nice byte array, 1 byte for each key, which you can even use to detect multimedia keys as they are all separate in the structure.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  7. #7

    WinAPI WM_KEYDOWN how to detect Alt of left

    Quote Originally Posted by Delfi
    So, why are you all ignoring the GetKeyboardState solution? that thing gives you a nice byte array, 1 byte for each key, which you can even use to detect multimedia keys as they are all separate in the structure.
    can you show some sample? actually this is not much clear... :?
    Knowledge is power.

  8. #8

    WinAPI WM_KEYDOWN how to detect Alt of left

    Quote Originally Posted by lordzero
    Quote Originally Posted by Delfi
    So, why are you all ignoring the GetKeyboardState solution? that thing gives you a nice byte array, 1 byte for each key, which you can even use to detect multimedia keys as they are all separate in the structure.
    can you show some sample? actually this is not much clear... :?
    http://msdn2.microsoft.com/en-us/library/ms646299(VS.85).aspx

    what you do, is fetch the array, and then check the array entry of say
    VK_LCONTROL or VK_RCONTROL number to see if key is pressed or not.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  9. #9

    WinAPI WM_KEYDOWN how to detect Alt of left

    thanks for all answers
    Knowledge is power.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •