The long-awaited Space Shooterz DX!

This is a discussion on The long-awaited Space Shooterz DX! within the Game Programming forums, part of the General Programming Boards category; Although the least significant bit of the return value indicates whether the key has been pressed since the last query, ...

  1. #61
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application. The behavior of the least significant bit of the return value is retained strictly for compatibility with 16-bit Windows applications (which are non-preemptive) and should not be relied upon.
    It's best to use "& 0x8000", and it lets you get rid of the bare GetAsyncKeystate(); in your code (which puzzled me at first).

    This is not important at all, though. Just a thought.

    Edit: 0x8000
    Last edited by Sang-drax; 06-15-2003 at 06:18 AM.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #62
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    It's best to use "& 0x800",
    Huh? Wait a minute, didn't you say 0x8000? Also, would it work to use LOWORD() and HIWORD() to check instead?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #63
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Never trust me, trust the Win API documentation.

    HIWORD and LOWORD won't work, but perhaps HIBYTE and LOBYTE will.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #64
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    *smacks head* Right, it's only GOT 2 bytes
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Page 5 of 5 FirstFirst 12345
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 12:29 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. hton long long
    By carrotcake1029 in forum C Programming
    Replies: 1
    Last Post: 06-01-2008, 09:26 PM
  4. can someone check this out and let me know ?
    By javaz in forum C Programming
    Replies: 5
    Last Post: 01-21-2002, 02:13 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM

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