如何获得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();
}
}
二、在系统“关于”中设置 的“设备标识”
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();
}
}
相关文章推荐
- 如何获得WM设备信息,如型号、操作系统版本等
- iOS如何获取屏幕宽高、设备型号、系统版本信息
- 在.Net Framework中获得Windows目录、机器名、操作系统版本信息等系统环境信息
- 在.Net Framework中获得Windows目录、机器名、操作系统版本信息等系统环境信息
- 如何获取安卓手机型号与设备信息
- 在VC中如何获得USB设备的Product ID,Vendor ID等信息
- 在.Net Framework中获得Windows目录、机器名、操作系统版本信息等系统环境信息
- 如何查看Xen、操作系统及内核版本信息
- 如何获得Windows 8 应用的版本信息
- 关于C#中如何使用wmi获得操作系统信息?
- 如何获取设备上运行的android版本信息
- Swift - 获取应用名称、应用版本、设备型号、系统版本等信息
- iOS获取屏幕宽高、设备型号、系统版本信息
- AndroidUtils(一)手机信息大全(设备ID、厂商、型号、系统、IMEI、SDK版本等)
- Swift - 获取应用名称、应用版本、设备型号、系统版本等信息
- 如何判断IOS的设备版本型号
- Linux下如何查看CPU型号、个数、核数、逻辑CPU数、位数、发行版本、内核信息、内存、服务器生产厂家
- .Net Framework中获得Windows目录、机器名、操作系统版本信息等系统环境信息
- Swift - 获取应用名称、应用版本、设备型号、系统版本等信息
- 如何使用API函数GetFileVersionInfo,获得版本信息