Mfc:id Naming and numerical conventions

Source: Internet
Author: User

This morning double-click on a newly compiled application, the interface has just shown, and automatically triggered a menu event, opened a Web page. It was a real surprise. Close the window, double-click again, and automatically open a webpage, then close, and then double-click, do not automatically open the Web page. What's the situation?

To Baidu Search "MFC Menu ID range", found a post from CSDN:

Http://topic.csdn.net/t/20030708/14/2003847.html

See the content of the last person who replied (SXSLYY):

See MFC Windows Programming page 199th ID to be a multiple of 16, because Windows reserved the System menu ID of the low four bits of their own use, so use any one of them, you can get unexpected results.

I understand that the original menu ID can not set the value casually, otherwise you will encounter unexpected results.

Then I found a post from Microsoft:
ID Naming and number conventions

HTTP://TECHNET.MICROSOFT.COM/ZH-CN/LIBRARY/T2ZECHD4 (v=vs.110). aspx

To understand that the menu ID, the icon Asset ID, and the control ID all have respective different values.

about the scope of custom message values :

Implemented a custom message in the Code SendMessage (), today did not want to find the original custom message umsg value needs greater than wm_user, such as Wm_user+1, on the line, and then look at my original set value: 12345, fortunately there is no problem.

Wm_user (value: 1024)

To prevent user-defined message IDs from conflicting with the system's message ID, MS (Microsoft) defines a macro wm_user that is less than the Wm_user ID being used by the system, and that the ID greater than Wm_user is used by the user. 2012-09-22

Mfc:id Naming and numerical conventions

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.