Why the MFC program returns a value that is not zero

Source: Internet
Author: User
Tags message queue

http://blog.csdn.net/ccnyou/article/details/7885393

A new project, do not add any code, delete the default confirmation Cancel button, and then run the discovery, click the close after the output box prompt:

Program "[3760] Demo.exe: Native" exited with a return value of 2 (0x2).

Generally we think that the normal end of the program return value should be 0, but then I did a test:

1, add a menu with the "Test" menu item

2, add a submenu named "Exit" with ID 32776

3, add the message response, Ontestquit, inside the code on one line: EndDialog (0), or change OnOK (), all to let the dialog box end, the program can exit

Then a miracle appeared, the following output is actually:

Program "[3760] Demo.exe: Native" has exited with a return value of 32776 (0xXXX);

Then I would like to say no more, it should be MFC the program message queue last message to take out as the exit value ... The pit Daddy ... been cheated.

Why the MFC program returns a value that is not zero

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.