I would like to check if .NET 3.5 Framework is installed by reading the “Install” value of the key “Software\Microsoft\NET Framework Setup\NDP\v3.5”. I am very happy to find out that there is an MFC class CSettingStore that can do the job easily but I found out the CSettingStore.Open always return false.
The code is as follow:
bool bOpen = reg.Open(_T("Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5"));
if (bOpen && reg.Read (_T("Install"), dwInstall))
{
return dwInstall == 1;
}
In this case, reg.Open always return false.
Anything wrong with the code?
In http://msdn.microsoft.com/en-us/library/bb982796.aspx I read:
The meaning of
bAdminis reversedActually, if
bAdminis true, the key isHKEY_LOCAL_MACHINEand, if it’s false, the key isHKEY_CURRENT_USER. You can see this for yourself inafxsettingsstore.cpp:So it looks like a documentation bug. Does
CSettingsStore reg (TRUE, TRUE);work better?