Thread: question about lParam

  1. #1
    Registered User
    Join Date
    Oct 2004

    question about lParam

    [in] Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag. For more information about the lParam parameter, see Keystroke Message Flags. This parameter can be one or more of the following values.
    Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user's holding down the key.
    Specifies the scan code. The value depends on the OEM.
    Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0.
    Specifies the context code. The value is 1 if the ALT key is down; otherwise, it is 0.
    Specifies the previous key state. The value is 1 if the key is down before the message is sent; it is 0 if the key is up.
    Specifies the transition state. The value is 0 if the key is being pressed and 1 if it is being released.

    in this description of what lParam will contain, how do i check to see what the transition state is?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well the description is a list of bit fields.

    So in unsigned arithmetic, it would be
    lParam & ( 1u << 31 )

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    You can also use the pre-defined flags.
    bIsUp      = (HIWORD(lParam) & KF_UP);
    bAltIsDown = (HIWORD(lParam) & KF_ALTDOWN);
    bExtended  = (HIWORD(lParam) & KF_EXTENDED);
    This is the list of flags:
    Quote Originally Posted by MSDN About Keyboard Input
    KF_ALTDOWN Manipulates the ALT key flag, which indicated if the ALT key is pressed.
    KF_DLGMODE Manipulates the dialog mode flag, which indicates whether a dialog box is active.
    KF_EXTENDED Manipulates the extended key flag.
    KF_MENUMODE Manipulates the menu mode flag, which indicates whether a menu is active.
    KF_REPEAT Manipulates the repeat count.
    KF_UP Manipulates the transition state flag.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. Cancel Button not working
    By Xzyx987X in forum Windows Programming
    Replies: 3
    Last Post: 10-27-2004, 12:41 AM
  3. Question...
    By TechWins in forum A Brief History of
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM