Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:12:56+00:00 2026-05-30T13:12:56+00:00

I try to register if a key has been toggled on or off like

  • 0

I try to register if a key has been toggled on or off like this:

if (pKeyBuffer[VK_TAB] & 0xFF81)
{
   functionA();
}

if (pKeyBuffer[VK_TAB] & 1)
{
   functionB();
}

But there is a big problem in the above code – state of the VK_TAB is not known at startup and because of that, sometimes, i have to press Tab one more time at the runtime to set it to the default state.

I cant use regular ‘0xF0’ or ‘0’ because i cant afford having functionA() or functionB() called multiple times. I need switch-like behavior(i.e. if Tab is pressed, even though it is being held down,
functionA() still executes only once).

So is there any way to get key state info to perform that first keystroke? Or maybe you can suggest some alternative approach? Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:12:57+00:00Added an answer on May 30, 2026 at 1:12 pm

    In a situation like this you want to use the GetKeyState function, this will get the key press and key toggle info at the time its called for the given key.

    so, if you want to check if tab is held down, use GetKeyState(VK_TAB) & 0x8000, if you want to check is its toggled use GetKeyState(VK_TAB) & 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(This is my first try with php) I have a very basic register page.
I have been trying to register 3 hotkeys. I followed this example (or this
I try to register to C2DM but it doesn't work. I included com.google.android.c2dm in
Sometimes when i try to register for C2DM, I get SERVICE_NOT_AVAILABLE error. I used
I have a doubt, when we try to register for C2DM, does the registration
I have my own templatetag: @register.inclusion_tag('path_to_module.html', takes_context=True) def getmodule(context, token): try: return slow_function(params) except
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
try: recursive_function() except RuntimeError e: # is this a max. recursion depth exceeded exception?
Here One server and one client is there. And communication has been maintained by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.