Bool and bool transformation Note: True is not necessarily 1. Such a bool will cause the checkbox value of the control to return to zero.

Source: Internet
Author: User

When the bool value transmitted from the configuration file, network, or other channels is assigned to bool, it is found that true is not necessarily 1.

This value may be incorrect due to other errors. Although it does not affect the logic, it still indicates that there is a logic error elsewhere.

Make good judgments and do not allow values other than 0 and 1 to enter bool,

Otherwise, the checkbox value of the control is returned to zero.

 

MFCCodeAs follows:

Void afxapi ddx_check (cdataexchange * PDX, int NIDC, Int & Value) <br/>{< br/> ...... <Br/> If (value <0 | value> 2) <br/> {<br/> trace (traceappmsg, 0, "Warning: dialog data checkbox value (% d) out of range. /n ", <br/> value); <br/> value = 0; // default to off <br/>}< br/> ...... <Br/>}

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.