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