If your program is depending on a specified version of Windows Media Center, just try the following code to identify Windows Media Center versions.
Sample Code:
//
// Get Windows Media Center version from registry
// Function return false if no media center is installed on your windows
//
// Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center
// Registry value name: Ident
// Registry value data type: REG_SZ
//
bool GetMediaCenterIdent(wstring& wstrIdent)
{
bool bRtn = false;
HKEY hkResult = NULL;
LONG lRetOpen = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center",
NULL, KEY_READ, &hkResult);
if(lRetOpen == ERROR_SUCCESS)
{
WCHAR wszRet[2048] = {0};
DWORD type_1 = REG_SZ;
DWORD cbData = sizeof(wszRet);
LONG lRetQuery = ::RegQueryValueExW(hkResult, L"Ident", NULL,
&type_1, (unsigned char *)wszRet, &cbData);
if(lRetQuery == ERROR_SUCCESS)
{
wstrIdent = wszRet;
bRtn = true;
}
}
if(hkResult)
{
::RegCloseKey(hkResult);
hkResult = NULL;
}
return bRtn;
}
Ident value v.s Windows Media Center version
< 2.7 = Windows XP Media Center Edition 2002
2.7 or 2.8 = Windows XP Media Center Edition 2004
3.0 = Windows XP Media Center Edition 2005
3.1 = Windows XP Media Center Edition 2005 with Update Rollup 1
4.0 = Windows XP Media Center Edition 2005 with Update Rollup 2
5.0 = Windows Vista
5.1 = Windows Vista with Media Center TV Pack 2008
6.0 = Windows 7
Reference on MSDN:
Identifying Windows Media Center Versions
Android 專用版 Facebook 推出更新版 1.6.0
13 years ago