Why does DS_SHELLFONT = DS_FIXEDSYS | DS_SETFONT?
You may have noticed that the numerical value of theDS_SHELLFONT
flag is equal toDS_FIXEDSYS | DS_SETFONT
.
#define DS_SETFONT 0x40L /* User specified font for Dlg controls */ #define DS_FIXEDSYS 0x0008L #define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
Surely that isn’t a coincidence.
The value of the DS_SHELLFONT
flag was chosen so thatolder operating systems (Windows 95, 98, NT 4) wouldaccept the flag while nevertheless ignoring it.This allowed people to write a single programthat got the “Windows 2000” lookwhen running on Windows 2000 and got the “classic” look whenrunning on older systems.(If you make people have to write two versions of their program,one that runs on all systems and one that runs only on the newersystem and looks slightly cooler,they will usually not bother writing the second one.)
The DS_FIXEDSYS
flag met these conditions.Older systems accepted the flag since it was indeed a valid flag,but they also ignored it because the DS_SETFONT
flagtakes precedence.
This is one of those backwards-compatibility exercises:How do you design something so that itis possible to write one program thatgets the new features on new systems while at the same timedegrading gracefully on old systems?
0 comments