读书人

怎么包裹理

发布时间: 2012-06-08 12:55:24 作者: rapoo

如何包裹理
在下面函中性oHwInf.MUILanguages(0)在非W7系下好像不存在,造成值出
我如何把包裹起,行,它值=空就可以了呢

Public Function ReadSoftinfo()

'On Error GoTo hErr
Dim osoft As SOFT

'(2)ノWMI描系信息
Set oResults = oCimv2.ExecQuery("select * from Win32_OperatingSystem", , 48)
For Each oHwInf In oResults
'Caption,Manufacturer,Version,WindowsDirectory,InstallDate,SerialNumber,MUILanguages,RegisteredUser
Set osoft = New SOFT
osoft.SoftTpye = "OS"
osoft.SoftCaption = clean((oHwInf.Caption))
osoft.SoftManufacturer = clean(oHwInf.Manufacturer)
osoft.SoftVersion = clean(oHwInf.Version)
osoft.SoftWindowsDirectory = clean(oHwInf.WindowsDirectory)
osoft.SoftInstallDate = Left(clean(oHwInf.InstallDate), 14)

osoft.SoftMUILanguages = (clean(oHwInf.MUILanguages(0)))
osoft.SoftSerialNumber = clean(oHwInf.SerialNumber)

osofts.Add osoft
Next


'Set oreg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'softinfs2

Exit Function

[解决办法]
Public Function ReadSoftinfo()

On Error GoTo hErr
Dim osoft As SOFT

'(2)ノWMI描系信息
Set oResults = oCimv2.ExecQuery("select * from Win32_OperatingSystem", , 48)
For Each oHwInf In oResults
'Caption,Manufacturer,Version,WindowsDirectory,InstallDate,SerialNumber,MUILanguages,RegisteredUser
Set osoft = New SOFT
osoft.SoftTpye = "OS"
osoft.SoftCaption = clean((oHwInf.Caption))
osoft.SoftManufacturer = clean(oHwInf.Manufacturer)
osoft.SoftVersion = clean(oHwInf.Version)
osoft.SoftWindowsDirectory = clean(oHwInf.WindowsDirectory)
osoft.SoftInstallDate = Left(clean(oHwInf.InstallDate), 14)

osoft.SoftMUILanguages = (clean(oHwInf.MUILanguages(0)))
osoft.SoftSerialNumber = clean(oHwInf.SerialNumber)

osofts.Add osoft
Next


'Set oreg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'softinfs2
hErr:
if err.numer=??? then '???你自己跟踪一下该错误号
resume next '这样处理后,如果是该错误,就会返回到出错的下一句执行
end if
Exit Function


[解决办法]
你的这个东西 是wmi wmi有些是需要有系统和库支持的 有些东西 是木有的 xp

读书人网 >VB

热点推荐