Win32 C - Control IDs of dynamically created controls?

248 Views Asked by At

I'm trying to create popout windows (like the dockable panes in Visual Studio). I need to create splitter controls to allow resizing of the controls when they're attached. I'm basing my design around the MFC docking panes and I'm trying not to hardcode docking regions.

Ideally I'd not like to have a fixed amount of sliders that are created hidden, but rather a variable amount depending on the location of each attached window. My current thoughts:

  1. Use SubtractRect() to subtract the RECT of the attached window from that of the effective client area.
  2. Create a slider for each edge of the control that is not on the edge of the main window's effective client area.

However when using CreateWindow() ideally a control ID would be passed in which is usually hard-coded in Resource.h, which then makes dynamic creation of controls tricky. Not to mention recalculating window sizes based on the location of the slider(s).

I'd thought about allocating an ID range to use for dynamic controls so I could start off with #define IDC_SPLITTER1 100 for example, then increment from this value for each splitter created. I've seen _APS_NEXT_RESOURCE_VALUE mentioned which I believe is used in MFC, but only for the IDE?

Sorry if this question is a bit wish-washy, I'm really struggling to get my head around this.

Thanks.

0

There are 0 best solutions below