首页 新闻 赞助 找找看

如何检测电脑是否安装了.net framework

0
[已关闭问题]

我的这个项目是用vs2005做的,程序启动的时候需要检测用户是否已经安装.net framework,在网络上查了一下,最广泛的是这样的代码

Code
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

 

但是这里我有几个地方不明白,首先,这个程序应该是VB6.0写的吧,如果是用.net写的根本运行不了。其次就是,这个DotNETFrameworkVersions,这个参数类型是怎么回事?是vb6.0里面的某种类型,还是怎么回事呢?希望做过这个方面的高手们帮帮忙……

天堂口的主页 天堂口 | 小虾三级 | 园豆:514
提问于:2008-12-13 14:13
< >
分享
其他回答(1)
0

这是微软的官方方法,你用程序来判一下就可以了。

http://support.microsoft.com/kb/318785

eaglet | 园豆:17139 (专家六级) | 2008-12-13 15:27
0

给一个参考的,用 c++ 写的。

http://www.codeproject.com/KB/dotnet/DetectDotNet.aspx

孤剑 | 园豆:328 (菜鸟二级) | 2008-12-14 00:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册