在VB.NET中检测PC制造商

时间:2014-12-02 21:49:08

标签: vb.net

是否可以在VB.NET中检测PC OEM制造商? 不是电脑的型号,只有戴尔,惠普,联想,宏碁,帕卡尔贝尔等?

2 个答案:

答案 0 :(得分:2)

您的BIOS的响应可能不是预期的,但您可以尝试使用此

Sub Main()
    Dim result = GetBiosProperty("Manufacturer")
    Console.WriteLine(result)
End Sub

Function GetBiosProperty(wmiProperty as string)
    Dim result = string.Empty
    Dim mc = new System.Management.ManagementClass("Win32_BIOS")
    Dim moc = mc.GetInstances()
    for each mo in moc
       if mo(wmiProperty) IsNot Nothing Then
           result = mo(wmiProperty).ToString()
           Exit For
       End If
    Next
    return result.Trim()
End Function

请注意,此代码需要引用System.Management.dll和System.Management命名空间的导入。

答案 1 :(得分:0)

此网站告诉您如何更改它,但相关的键位于下方。 http://www.techrepublic.com/blog/user-support/change-the-oem-information-in-the-windows-system-properties-panel-to-your-own/

注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation

值:

Manufacturer

这个问题提供了使用.NET阅读注册表的建议:.net registry reading writing

相关问题