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

作者:网络 来源:佚名 更新时间:2008-02-06 06:42:36 点击:


检查/%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