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 7916657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:53:16+00:00 2026-06-03T14:53:16+00:00

In Charles Petzold’s book Programming Windows, he mentioned the following: Be careful with GetKeyState.

  • 0

In Charles Petzold’s book “Programming Windows”, he mentioned the following:

“Be careful with GetKeyState. It is not a real-time keyboard status check. Rather it reflects the keyboard status up to and including the current message being processed.”

“Do not do while(GetKeyState(VK_F1) >= 0);“, it is guaranteed to hang your program.

I don’t understand these at all. Could someone give an explanation for these two facts, please.

  • 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-06-03T14:53:18+00:00Added an answer on June 3, 2026 at 2:53 pm

    Every time you read a queued keyboard message, for example by calling GetMessage, the OS updates private keyboard state data associated with the calling thread. When you call GetKeyState that private keyboard state data is used to determine the returned key state. Thus, so long as you don’t read another queued message, GetKeyState will always return the same value.

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

Sidebar

Related Questions

I followed an example in Charles Petzold's book Programming Windows. That example shows the
Years ago, in my long lost copy of Charles Petzold's Windows 3.0 Programming book,
I am studying the Windows programming by using the book Programming.Windows.5th.Edition(Charles Petzold). When I
I am reading Charles Petzold's Programming windows. 5th Edition. And there is a statement
Based on information in Chapter 7 of 3D Programming For Windows (Charles Petzold) ,
I am reading Programming.Windows.5th.Edition,Charles Petzold when I was doing the Figure 4-5. SYSMETS1.C,I met
I am learning about the Intel 8080 processor in Charles Petzold's excellent book Code
I am currently reading Charles Petzold's book 'Code'. In it he explains how to
As a big fan of Charles Petzold's books Code and The Annotated Turing I
We followed the instructions in the following page. http://www.charlesproxy.com/documentation/faqs/using-charles-from-an-iphone/ But it doesn't seem to

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.