February 4th, 2005

What's the deal with the DS_SHELLFONT flag?

It indicates that you want the Windows 2000 default shell font. But that doesn’t mean that you’re going to get it. In order to indicate that you would like the “Windows 2000” look for your dialog, you have to do three things and hope for a fourth:

  1. Use a DIALOGEX template instead of a DIALOG template.
  2. Set the DS_SHELLFONT flag in your dialog styles.
  3. Set the dialog font to “MS Shell Dlg”.
  4. Hope that you’re running on Windows 2000 or later on a system that has the new Windows 2000 dialog font enabled.

If all four conditions are satisfied, then your dialog gets the “Windows 2000” look. If any condition fails, then you get the “classic” dialog font. Note that the fourth condition is not within your program’s control. Consequently, you have to make sure your dialog looks good in both the “classic” dialog font and the new one. For property sheet pages, things are more complicated. It would be visually jarring for there to be a mix of fonts on a property sheet. You wouldn’t want the “Advanced” button to be in MS Sans Serif but the “Apply” button in Tahoma. To avoid this problem, the property sheet manager looks at all the pages in the property sheet. If they are all using the “Windows 2000” look, then the property sheet uses the “Windows 2000” look also. But if there is even a single page that does not use the “Windows 2000” look, then the property sheet reverts to the “classic” look and also converts all the “Windows 2000”-look pages to “classic” look. This way, all the pages in the property sheet have the “classic” look instead of having a mishmash of some pages with the classic look and some with the Windows 2000 look. That’s why you will occasionally find that a shell property sheet has reverted to the “classic” look. Some shell extension infected the property sheet with a page that does not have the “Windows 2000” look, and for the sake of visual consistency, the property sheet manager set all the pages on the property sheet to “classic” look.

This is another reason it is important that you test your property sheet pages both with the “Windows 2000” look and the “classic” look. If your property sheet page ends up sharing a property sheet with a non-“Windows 2000”-look page, your page is going to be reverted to “classic” look.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.