For enumerating the controls in a dialog template, check this article

Enumerating Controls of a Dialog Resource at Runtime