.NET Framework version 4.5 and higher can be determined with the following C++ code:
#include <windows.h>
bool IsDotNet45Installed()
{
DWORD value{};
DWORD dataSize = sizeof(value);
const LONG retCode = ::RegGetValue(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\",
L"Release",
RRF_RT_REG_DWORD,
nullptr,
&value,
&dataSize
);
if (retCode != ERROR_SUCCESS)
{
return false;
}
return value >= 378389;
}