C#获取CPU个数
来源:互联网 发布:ipad客户端办公软件 编辑:程序博客网 时间:2024/06/07 07:48
首先添加引用#region Using directivesusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;#endregionnamespace ConsoleApplication1{ class Program { //引入32库,kernel32.dll内封装了WIN32 API [DllImport("kernel32")] public static extern void GetSystemInfo(ref CPU_INFO cpuinfo); [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; } static void Main(string[] args) { CPU_INFO CpuInfo; CpuInfo = new CPU_INFO(); //设置为引用类型,可以让CpuInfo的值可以被修改 GetSystemInfo(ref CpuInfo); String Text = "本计算机中有" + CpuInfo.dwNumberOfProcessors.ToString() + "个CPU"; Console.WriteLine(Text); Console.ReadKey(); } }}
0 0
- C#获取CPU个数
- 获取系统CPU 个数
- 获取系统CPU 个数
- C#获取CPU编号
- C# 获取CPU温度
- C# 获取CPU序列号
- C# 获取CPU信息
- [Windows编程] 获取系统CPU 个数
- 汇编获取CPU机器周期个数
- 九、获取 cpu 个数和 cpu 核(core)数
- C#获取CPU的利用率
- C#获取CPU核心数
- Linux上获取CPU Core个数的实现
- Java获取电脑CPU个数及系统信息
- Java获取电脑CPU个数及系统信息
- 用C#实时获取CPU利用率
- C#获取CPU网卡等硬件信息
- 用C#获取CPU的ID编号
- 新浪微博开发二(底部菜单栏的实现)
- POJ 2109 Power of Cryptography
- 美国麻省理工教授亲授科研学习方法(上)
- linux下重启oracle
- 带进度边框的自定义TextView
- C#获取CPU个数
- C语言: 指针强制类型转换
- Swift基础语法: 22 - Swift的函数类型, 嵌套函数
- svn提交异常"svn: 丢失了预定增加的"
- 计算机科学知识和技能评估
- PHP内核探索之变量(6)- 后续内核探索系列大纲备忘
- 数据库索引的作用和优点缺点
- UIView 大小大于8192时drawRect就没效果了,android也有这个问题
- Ubuntu 14.10 gedit 鼠标指针隐藏问题的解决方法