Well, listbox controls have the ATTR_HILITE_CURRENT_ITEM which does exactly what we are looking for: determining wether the active element is highlighted or not, regardless the control is the active one or not or is hot or indicator. It would be maybe simpler using the same attribute for tables too rather than playing with the selection color.