I have a menu-like MFC control which hosts a lot of menu-entries (with command IDs). The number of menu-entries as well as the structure changes dynamically during runtime. That means that I have to create controls and assign new IDs dynamically from time to time.
What I did so far is to reserve a large static range of IDs and assign them sequentially. Even though the range is pretty large I'm afraid I will end up at the point where there are no IDs left. I cannot start over at the beginning either because I do not know which of the previously assigned IDs have been released.
My first thought was to find the largest command ID in the current resource handle and start from there. But I don't know how to accomplish that.
Or is there a better way to manage this? I think I might not be the first person with this kind of problem.