To programmatically determine the type of a control you can use
GetCtrlAttribute (panel, control, GetCtrlAttribute (panel, control, ATTR_CTRL_STYLE, &style);
The value in "style" can be compared with the corresponding constants fountd in userint.h (for example CTRL_RING or CTRL_TEXT_BOX).