C#获取计算机系统信息的方法
C#获取系统信息
方法一:利用注册表获取
//RegistryKey 类所需要的包:
//RegistryKey 类所需要的包:
using Microsoft.Win32;
//DllImport方法所需要的包:
using System.Runtime.InteropServices;
//StringBuilder所需要的包:
using System.Text;
//声明API函数
[DllImport("kernel32")]
public static extern void GetWindowsDirectory(StringBuilder WinDir,int count);
[DllImport("kernel32")]
public static extern void GetSystemDirectory(StringBuilder SysDir,int count);
[DllImport("kernel32")]
public static extern void GetSystemInfo(ref CPU_INFO cpuinfo);
[DllImport("kernel32")]
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
[DllImport("kernel32")]
public static extern void GetSystemTime(ref SYSTEMTIME_INFO stinfo);
//定义以下各结构
//定义CPU的信息结构
[StructLayout(LayoutKind.Sequential)]
public struct CPU_INFO
{
public uint dwOemId;
public uint dwPageSize;
public uint lpMinimumApplicationAddress;
public uint lpMaximumApplicationAddress;
public uint dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public uint dwProcessorLevel;
public uint dwProcessorRevision;
}
//定义内存的信息结构
[StructLayout(LayoutKind.Sequential)]
public struct MEMORY_INFO
{
public uint dwLength;
public uint dwMemoryLoad;
C#获取系统信息 方法一:利用注册表获取 //RegistryKey 类所需要的包: //RegistryKey 类所需要的包: using Microsoft.Win32; //DllImport 方法所需要的包: ...
C#获取计算机系统信息的方法_数学_小学教育_教育专区。C#获取计算机系统信息的方法 ; //DllImport方法所需要的包: using System.Runtime.InteropServices; //String...
C# 获取系统信息_IT/计算机_专业资料。C# 获取系统信息获取电脑系统信息第一种方法:用 第一种方法 用 SystemInformation 类 SystemInformation 提供静态方法和属性,它...
C#获取系统信息 所谓系统信息,就是计算机的软件硬件信息,硬件如CPU主频、网卡名称...总之,读取系统信息对于编程还是很重要的,.NET也不负所望,提供了很便利的方法,...
C#调用API函数获取系统信息_计算机软件及应用_IT/计算机_专业资料。C#调用API函数...各个 API 函数获取了系统的相 关信息, 并最终在界面上以文本标签的方式显示...
C#获取当前计算机的系统信息 获取当前计算机的系统信息 //系统标识符和版本号 ...} } #endregion #region 获取硬件信息的方法 /// /// 获得 CPU 编号 //...
C# 获取系统路径方法_电脑基础知识_IT/计算机_专业资料。C# 获取系统路径的方法 返回“我的文档”路径字符串 Environment.GetFolderPath(Environment.SpecialFolder....
C#如何实现获取电脑硬件配置信息_电脑基础知识_IT/计算机_专业资料。C#如何实现...管理员可以通过一种简便的方法即利用常见的脚本语言实 WMI 现常用的系统管理任务...
C#通过 NetFramework 4的WMI获取计算机软硬件信息的方法_电脑基础知识_IT/计算机_专业资料。C#通过.NetFramework 4.0的WMI获取计算机软硬件信息的方法,给出了程序事例...
C#获取数据库表信息与列信息的方法_计算机软件及应用_IT/计算机_专业资料。C#中...如果要获取所有的用户表,而非 系统表,可用如下语句: conn.Open(); string[]...
闽公网安备 35021102001881号 
热门文档