c++ - Win32 resource.hpp Why Such High Resource IDs? -


I'm learning Win32 GUI programming today and I have a question that I have not received the answer to.

Why Resources Do HP files define resources with such high ID numbers? For example, I am using 2 resources in the resources of the following tutorials. RC - One menu and one ICON. There are 3 total menu totals in the menu.

Here is the resource of tutorials. Hpp (which defines the int id for these resources):

  define # IDR_ MYMENU 101 / MENU ID #define IDI_MYICON 102 // icon id #define ID_FILE_EXIT 40001 // MENUITEM 1 ID #define ID_STUFF_GO 40002 // MENUITEM 2 ID #define ID_STUFF_GOSOMEWHEREELSE 40,003 // MENUITEM 3 ID   

Why not use instead

  #define IDR_MYMENU 1 // Menu ID #define IDI_MYICON 2 // Icon id #define ID_FILE_EXIT 3 // MENUITEM 1 ID #define ID_STUFF_GO 4 // MENUITEM 2 ID #: ID defined as ID IDF_GOSOMEWHEREELSE 5 // MENUITEM 3 ID  < / pre> 

More resources added May include, if you only increase in number I can understand the buffer to isolate MENUITEMS the ICONS am and similar; But why this buffer with so little resources?

I also process this resource by one. The HP file (tutorial) was generated, but the question still stands for me.

> Can someone illuminate me? Thank you.

It is fine that they are high because there is still no chance that you will participate.

So, why are more numbers better than fewer numbers?

Would you like that IDs may be as unique as possible? Not just between each other, but when you see "40089" anywhere in your program, it's good that it is a resource ID, it can help debugging.

I have seen the same pattern in the database, where there is no type of security and every object has an ID, for example you think this is a Employee.ID While "22011" is most likely a Department.ID etc. "20032" somewhere, you know an ID already know whether or not.

Personally I do not understand the point of separating the icon resource ID from the menu item. All of them are just resource IDs, and the difference seems too arbitrary to jump from 100 to 40000 guarantee that you will never come out of the id for the icon.

Of course this is not a complete answer. Why Specific Patterns? Why Specific Numbers? I suspect that you will find the real answer to this stuff; This is just how implemented.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -