Win32 UI: Eliminate some magic numbers, and make several functions more consistent with each other.