Change control type at runtime. SubclassWindow()
Posted on 2007-08-01
Change a control class at runtime. For reasons that are not real important here, I have a dialog with about a hundred controls on it that sometimes sum columns and/or rows. This begs for treatment as an array.
It works perfectly except for one thing, and that is the subclassing. Some of the controls need to become CDollarEdits or CDateEdits, and rather than do this by declaring a large number of control variables, I would like to use SubclassDlgItem or SubclassWindow.
I'm not using variables at all, just GetDlgItem() for the controls all line up nicely in resource.h. In other words, there is no conflict with DDX.
//perform some operations on pWnd
This compiles and executes without complaint except that the behavior of the controls doesn't change at all.
Any ideas, Rick