Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

keyboard scan codes

kackac Member Posts: 15
Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
please help me! I have got no idea how to solve this!
thanks

Comments

  • zibadianzibadian Member Posts: 6,349
    : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : please help me! I have got no idea how to solve this!
    : thanks
    :
    There are two types of scan-codes: the hardware codes and the virtual codes. The hardware codes are sent by the keyboard to the keyboard port, which are translated by windows to the virtual key codes. If you are interested in the hardware codes, I would suggest that you ask for it at the assembly board, because you'll probably need assemby for that.
    The virtual key codes are listed in the Windows unit.
  • kackac Member Posts: 15
    : : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : : please help me! I have got no idea how to solve this!
    : : thanks
    : :
    : There are two types of scan-codes: the hardware codes and the virtual codes. The hardware codes are sent by the keyboard to the keyboard port, which are translated by windows to the virtual key codes. If you are interested in the hardware codes, I would suggest that you ask for it at the assembly board, because you'll probably need assemby for that.
    : The virtual key codes are listed in the Windows unit.
    :
    yes i need the hardware ones... that's a pitty that theres no possibility to capture them from delphi... thank you for help...
    if anyone knows the ready solution please let me know...
    best regards
  • MasterijnMasterijn Member Posts: 188
    [b][red]This message was edited by Masterijn at 2003-12-29 10:54:11[/red][/b][hr]
    : : : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : : : please help me! I have got no idea how to solve this!
    : : : thanks
    : : :
    : : There are two types of scan-codes: the hardware codes and the virtual codes. The hardware codes are sent by the keyboard to the keyboard port, which are translated by windows to the virtual key codes. If you are interested in the hardware codes, I would suggest that you ask for it at the assembly board, because you'll probably need assemby for that.
    : : The virtual key codes are listed in the Windows unit.
    : :
    : yes i need the hardware ones... that's a pitty that theres no possibility to capture them from delphi... thank you for help...
    : if anyone knows the ready solution please let me know...
    : best regards
    :

    What about using MapVirtualKey?
    You should use it OnKeyDown or OnKeyUp, as suggested above. If this doesn't work, you can probably need a home-made keyboard driver. From wich device do you need capturing? Some devices support reprogramming.





  • zibadianzibadian Member Posts: 6,349
    : [b][red]This message was edited by Masterijn at 2003-12-29 10:54:11[/red][/b][hr]
    : : : : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : : : : please help me! I have got no idea how to solve this!
    : : : : thanks
    : : : :
    : : : There are two types of scan-codes: the hardware codes and the virtual codes. The hardware codes are sent by the keyboard to the keyboard port, which are translated by windows to the virtual key codes. If you are interested in the hardware codes, I would suggest that you ask for it at the assembly board, because you'll probably need assemby for that.
    : : : The virtual key codes are listed in the Windows unit.
    : : :
    : : yes i need the hardware ones... that's a pitty that theres no possibility to capture them from delphi... thank you for help...
    : : if anyone knows the ready solution please let me know...
    : : best regards
    : :
    :
    : What about using MapVirtualKey?
    : You should use it OnKeyDown or OnKeyUp, as suggested above. If this doesn't work, you can probably need a home-made keyboard driver. From wich device do you need capturing? Some devices support reprogramming.
    :
    :
    :
    :
    MapVirtualKey only gets you the windows key-codes, and not the hardware ones.
  • MasterijnMasterijn Member Posts: 188
    : : [b][red]This message was edited by Masterijn at 2003-12-29 10:54:11[/red][/b][hr]
    : : : : : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : : : : : please help me! I have got no idea how to solve this!
    : : : : : thanks
    : : : : :
    : : : : There are two types of scan-codes: the hardware codes and the virtual codes. The hardware codes are sent by the keyboard to the keyboard port, which are translated by windows to the virtual key codes. If you are interested in the hardware codes, I would suggest that you ask for it at the assembly board, because you'll probably need assemby for that.
    : : : : The virtual key codes are listed in the Windows unit.
    : : : :
    : : : yes i need the hardware ones... that's a pitty that theres no possibility to capture them from delphi... thank you for help...
    : : : if anyone knows the ready solution please let me know...
    : : : best regards
    : : :
    : :
    : : What about using MapVirtualKey?
    : : You should use it OnKeyDown or OnKeyUp, as suggested above. If this doesn't work, you can probably need a home-made keyboard driver. From wich device do you need capturing? Some devices support reprogramming.
    : :
    : :
    : :
    : :
    : MapVirtualKey only gets you the windows key-codes, and not the hardware ones.
    :
    if it's called like MapVirtualKey(VirtualCode, 0) it returns the scancode. The SDK says.

  • MasterijnMasterijn Member Posts: 188
    : Is it possible to read a scan code of the pressed key? (I want to read scan code not an ASCI code)
    : please help me! I have got no idea how to solve this!
    : thanks
    :
    procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
    the scancode can be extracted from Message.KeyData
    Scancode := (Message.KeyData shr 16) and $FF;

    SDK:
    [code]
    lParam
    Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.
    0-15
    Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
    16-23
    Specifies the scan code. The value depends on the 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.
    25-28
    Reserved; do not use.
    29
    Specifies the context code. The value is always 0 for a WM_KEYDOWN message.
    30
    Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
    31
    Specifies the transition state. The value is always zero for a WM_KEYDOWN message.
    [/code]



Sign In or Register to comment.