如何获得WM设备信息,如型号、操作系统版本等
一、获得操作系统版本号:System.Environment.OSVersion.Version
二、在系统“关于”中设置 的“设备标识”
private string GetDeviceName()
{
return System.Net.Dns.GetHostName();//ppc or smtphone
}
或者
public static string MachineName
{
get
{
string machineName = "";
try
{
RegistryKey ident = Registry.LocalMachine.OpenSubKey("Ident");
machineName = ident.GetValue("Name").ToString();
ident.Close();
}
catch
{
throw new PlatformNotSupportedException();
}
return machineName;
}
}
三、获得设备型号
/// <summary>
/// 获得 OEM 信息. 为设备型号
/// </summary>
public static string OemInfo
{
get
{
StringBuilder oemInfo = new StringBuilder(50);
if(SystemParametersInfo4Strings((uint)SystemParametersInfoActions.GetOemInfo, (uint)oemInfo.Capacity, oemInfo,0) == 0)
{
throw new Exception("Retrieving OEM info failed");
}
return oemInfo.ToString();
}
}
补充:软件开发 , C# ,