Determining the Local Client Operating System

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

For Microsoft Windows versions prior to XP, a ListView control cannot display items in groups. For this reason, the sample code checks the OS version and OS feature-set. If the client OS is XP or later and the feature-set includes Themes, contacts are loaded into groups. Otherwise, the example code uses the IMessenger::MyContacts property to load the contacts directly into the ListView control without grouping.

Application.EnableVisualStyles();
bool isRunningXPOrLater = OSFeature.Feature.IsPresent(OSFeature.Themes);
...
if (isRunningXPOrLater == true &&
OSFeature.Feature.IsPresent(OSFeature.Themes))
{
 // contact group code
...
}
else
{
 // contact list code
 ...
}

See Also

Concepts

Building a Custom Contact List