Dragon Book DX9 Chapter5 Light Creation and getasynckeystate () &0x8000f issues

Source: Internet
Author: User

Note 1: When we find a text, press the physical button a AAAAA, you will find that the first time there will be a partition.

Reference:http://tieba.baidu.com/p/1829831956

How does the return value of Getasynckeystate () understand?

The instance code has the IF (:: Getasynckeystate (vk_right) & 0x8000f) This sentence, press the → Key to get 0x1

void Main () {    staticint testint=0;      while (1)    {        if( short a =(:: Getasynckeystate (Vk_right)))//        {        cout< <a<<Endl;              cout<<testInt++<<" times "<<Endl;     }}}

The above code results found that-32767 appeared once.

if (Short a = (:: Getasynckeystate (Vk_right)) &0x8000f), press output only once 1

Where short negative numbers are stored in the form of a complement to the computer, 32767 is 0x8001-32768 for 0x8000

Summary: 1. When we continue to press the key not to release, use Getasynckeystate (vk_right)) &0x8000f) only return once true; 2. 0X8000F where the starting 8 does not work

Dragon Book DX9 Chapter5 Light Creation and getasynckeystate () &0x8000f issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.