检查/%windir%/System32/下面是否含有MSCOREE.DLL文件如果有就所名已经安装了FM
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/policy下可以检查到机器上安装了那些版本的FM
具体函数:
Public Function DoesDotNETFrameworkExist(ByVal udeVersion As DotNETFrameworkVersions) As Boolean
Dim o_blnRet As Boolean
Dim o_strRet As String
With New cRegistry
.hKey = HKEY_LOCAL_MACHINE
.KeyPath = "Software/Microsoft/.NETFramework"
If .DoesKeyExist() Then
.KeyPath = "Software/Microsoft/.NETFramework"
o_strRet = GetRegValue(.GetRegistryValue("InstallRoot", ""))
o_blnRet = (o_strRet <> "")
If o_blnRet Then
With New cFileFuncs
Select Case udeVersion
Case dnfvV1
o_blnRet = .DoesFileExistEx(o_strRet & "v1.0.3705/mscorlib.dll")
Case dnfvV1_1
o_blnRet = .DoesFileExistEx(o_strRet & "v1.1.4322/mscorlib.dll")
Case dnfvVAny
o_blnRet = .DoesFileExistEx(o_strRet & "v1.0.3705/mscorlib.dll")
If o_blnRet Then
Else
o_blnRet = .DoesFileExistEx(o_strRet & "v1.1.4322/mscorlib.dll")
End If
End Select
End With
Else
End If
Else
o_blnRet = False
End If
End With
DoesDotNETFrameworkExist = o_blnRet
End Function
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/policy下可以检查到机器上安装了那些版本的FM
具体函数:
Public Function DoesDotNETFrameworkExist(ByVal udeVersion As DotNETFrameworkVersions) As Boolean
Dim o_blnRet As Boolean
Dim o_strRet As String
With New cRegistry
.hKey = HKEY_LOCAL_MACHINE
.KeyPath = "Software/Microsoft/.NETFramework"
If .DoesKeyExist() Then
.KeyPath = "Software/Microsoft/.NETFramework"
o_strRet = GetRegValue(.GetRegistryValue("InstallRoot", ""))
o_blnRet = (o_strRet <> "")
If o_blnRet Then
With New cFileFuncs
Select Case udeVersion
Case dnfvV1
o_blnRet = .DoesFileExistEx(o_strRet & "v1.0.3705/mscorlib.dll")
Case dnfvV1_1
o_blnRet = .DoesFileExistEx(o_strRet & "v1.1.4322/mscorlib.dll")
Case dnfvVAny
o_blnRet = .DoesFileExistEx(o_strRet & "v1.0.3705/mscorlib.dll")
If o_blnRet Then
Else
o_blnRet = .DoesFileExistEx(o_strRet & "v1.1.4322/mscorlib.dll")
End If
End Select
End With
Else
End If
Else
o_blnRet = False
End If
End With
DoesDotNETFrameworkExist = o_blnRet
End Function
本文提供了一个检查本地机器是否已安装指定版本的.NET Framework的方法。通过读取注册表和验证特定文件的存在来判断版本是否存在。
4026

被折叠的 条评论
为什么被折叠?



