When creating a child control the control ID is passed to CreateWindow
as the hMenu
parameter. The parameter's documentation contains the following section (emphasis mine):
For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.
Apart from being unique among its siblings the window ID must fit into 16 bits (valid range is 8 to 0xDFFF). You can place your IDs into the VS-controlled Resource.h file and update the value of _APS_NEXT_CONTROL_VALUE
to prevent collisions with siblings created from dialog resources.