您的位置:首页 > 其它

如何获得WM设备信息,如型号、操作系统版本等

2009-01-09 10:00 435 查看
一、获得操作系统版本号: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();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: