- 浏览: 275532 次
- 性别:
- 来自: 湖南岳阳
最新评论
-
ternus:
兄弟,我用boboBrowse 也遇到了排序的问题,上线了讨论 ...
lucene 分组 bobo-Browse 排序的问题 -
luli0822:
Awesome bookmarks of those guru ...
流行的jQuery信息提示插件(jQuery Tooltip Plugin) -
shenbai:
如果你要在前台运行,你应该run得是ElasticSearch ...
ElasticSearch 源码分析 环境入门 -
cl1154781231:
<s:peroperty value="#at ...
关于Struts2中标签的一些心得 -
RonQi:
转载的吗?http://blog.csdn.net/stray ...
利用bobo-browse 实现lucene的分组统计功能
C#精髓
第二讲 WMI完美秀出CPU编号厂商主频电压等全部信息
作者:清清月儿
主页:http://blog.csdn.net/21aspnet/ 时间:2007.3.23
关于WMI MSDN有详细说明。 本文列举数例算抛砖引玉吧。WMI是个好东西,看过本文后也许你应该能举一反三参考MSDN也许自己做个优化大师也是可能的。
本文的例子在以下环境调试通过:Windows2003+AMD64双核CPU+VisualStudio2005(C#)下调试通过,无错版!
首先要添加“引用”一个dll,选择“System Management”;
再引入2个命名空间:
using System.Management;
using System.IO;
foreach循环:声明一个迭代变量自动获取数组中每个元素的值。
String.Format:格式化字符,本站就有解释。
代码:
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Management;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//获取CPU编号
ManagementClass MyClass = new ManagementClass("Win32_Processor");
ManagementObjectCollection MyCollection = MyClass.GetInstances();
String MyInfo = "当前系统CPU编号是:";
string MyCPUID = "";
foreach (ManagementObject MyObject in MyCollection)
{
MyCPUID = MyObject.Properties["ProcessorId"].Value.ToString();
break;
}
MyInfo += MyCPUID;
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button2_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前电压
String MyInfo = "计算机CPU的当前电压是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
try
{
MyInfo += "\n" + String.Format("CurrentVoltage : " + MyObject["CurrentVoltage"].ToString());
MyInfo += "\n=========================================================";
}
catch { }
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button3_Click(object sender, EventArgs e)
{
//获取计算机CPU的外部频率
String MyInfo = "计算机CPU的外部频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
try
{
MyInfo += "\n" + String.Format("ExtClock : " + MyObject["ExtClock"].ToString());
MyInfo += "\n=========================================================";
}
catch { }
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button4_Click(object sender, EventArgs e)
{
//获取计算机CPU的二级缓存
String MyInfo = "计算机CPU的二级缓存尺寸是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("L2CacheSize: " + MyObject["L2CacheSize"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button5_Click(object sender, EventArgs e)
{
//获取计算机CPU的制造商名称
String MyInfo = "计算机CPU的制造商名称是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Manufacturer : " + MyObject["Manufacturer"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button6_Click(object sender, EventArgs e)
{
//获取计算机CPU的产品名称
String MyInfo = "计算机CPU的产品名称是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Name : " + MyObject["Name"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button7_Click(object sender, EventArgs e)
{
//获取计算机CPU的版本信息
String MyInfo = "计算机CPU的版本信息如下:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Version: " + MyObject["Version"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button8_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前使用百分比 注意要把SQLserver或者其他耗CPU的软件开着否则看不到效果就一直为0
String MyInfo = "计算机CPU的当前使用百分比是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("LoadPercentage : " + MyObject["LoadPercentage"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button9_Click(object sender, EventArgs e)
{
//获取计算机CPU的最大时钟频率
String MyInfo = "计算机CPU的最大时钟频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("MaxClockSpeed : " + MyObject["MaxClockSpeed"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button10_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前时钟频率
String MyInfo = "计算机CPU的当前时钟频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("CurrentClockSpeed : " + MyObject["CurrentClockSpeed"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button11_Click(object sender, EventArgs e)
{
//获取计算机的CPU地址宽度
String MyInfo = "当前计算机的CPU地址宽度是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("AddressWidth: " + MyObject["AddressWidth"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button14_Click(object sender, EventArgs e)
{
//获取计算机的CPU数据宽度
String MyInfo = "当前计算机的CPU数据宽度是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("DataWidth : " + MyObject["DataWidth"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Form1.Designer.cs
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(182, 23);
this.button1.TabIndex = 5;
this.button1.Text = "获取CPU编号";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 41);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(186, 23);
this.button2.TabIndex = 17;
this.button2.Text = "获取计算机CPU的当前电压";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(12, 70);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(186, 23);
this.button3.TabIndex = 18;
this.button3.Text = "获取计算机CPU的外部频率";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(12, 99);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(186, 23);
this.button4.TabIndex = 19;
this.button4.Text = "获取计算机CPU的二级缓存";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(12, 128);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(186, 23);
this.button5.TabIndex = 21;
this.button5.Text = "获取计算机CPU的制造商名称";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(204, 157);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(206, 23);
this.button6.TabIndex = 22;
this.button6.Text = "获取计算机CPU的产品名称";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(12, 158);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(186, 23);
this.button7.TabIndex = 23;
this.button7.Text = "获取计算机CPU的版本信息";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(204, 70);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(204, 23);
this.button8.TabIndex = 24;
this.button8.Text = "获取计算机CPU的当前使用百分比";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button9
//
this.button9.Location = new System.Drawing.Point(204, 41);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(204, 23);
this.button9.TabIndex = 25;
this.button9.Text = "获取计算机CPU的最大时钟频率";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(202, 12);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(204, 23);
this.button10.TabIndex = 26;
this.button10.Text = "获取计算机CPU的当前时钟频率";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button11
//
this.button11.Location = new System.Drawing.Point(204, 99);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(204, 23);
this.button11.TabIndex = 27;
this.button11.Text = "获取计算机的CPU地址宽度";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button14
//
this.button14.Location = new System.Drawing.Point(204, 128);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(204, 23);
this.button14.TabIndex = 28;
this.button14.Text = "获取计算机的CPU数据宽度";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 193);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(341, 12);
this.label1.TabIndex = 29;
this.label1.Text = "作者:清清月儿 http://blog.csdn.net/21aspnet/ 2007.3.23";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(422, 214);
this.Controls.Add(this.label1);
this.Controls.Add(this.button14);
this.Controls.Add(this.button11);
this.Controls.Add(this.button10);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Label label1;
}
}
第二讲 WMI完美秀出CPU编号厂商主频电压等全部信息
作者:清清月儿
主页:http://blog.csdn.net/21aspnet/ 时间:2007.3.23
关于WMI MSDN有详细说明。 本文列举数例算抛砖引玉吧。WMI是个好东西,看过本文后也许你应该能举一反三参考MSDN也许自己做个优化大师也是可能的。
本文的例子在以下环境调试通过:Windows2003+AMD64双核CPU+VisualStudio2005(C#)下调试通过,无错版!
首先要添加“引用”一个dll,选择“System Management”;
再引入2个命名空间:
using System.Management;
using System.IO;
foreach循环:声明一个迭代变量自动获取数组中每个元素的值。
String.Format:格式化字符,本站就有解释。
代码:
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Management;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//获取CPU编号
ManagementClass MyClass = new ManagementClass("Win32_Processor");
ManagementObjectCollection MyCollection = MyClass.GetInstances();
String MyInfo = "当前系统CPU编号是:";
string MyCPUID = "";
foreach (ManagementObject MyObject in MyCollection)
{
MyCPUID = MyObject.Properties["ProcessorId"].Value.ToString();
break;
}
MyInfo += MyCPUID;
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button2_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前电压
String MyInfo = "计算机CPU的当前电压是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
try
{
MyInfo += "\n" + String.Format("CurrentVoltage : " + MyObject["CurrentVoltage"].ToString());
MyInfo += "\n=========================================================";
}
catch { }
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button3_Click(object sender, EventArgs e)
{
//获取计算机CPU的外部频率
String MyInfo = "计算机CPU的外部频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
try
{
MyInfo += "\n" + String.Format("ExtClock : " + MyObject["ExtClock"].ToString());
MyInfo += "\n=========================================================";
}
catch { }
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button4_Click(object sender, EventArgs e)
{
//获取计算机CPU的二级缓存
String MyInfo = "计算机CPU的二级缓存尺寸是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("L2CacheSize: " + MyObject["L2CacheSize"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button5_Click(object sender, EventArgs e)
{
//获取计算机CPU的制造商名称
String MyInfo = "计算机CPU的制造商名称是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Manufacturer : " + MyObject["Manufacturer"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button6_Click(object sender, EventArgs e)
{
//获取计算机CPU的产品名称
String MyInfo = "计算机CPU的产品名称是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Name : " + MyObject["Name"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button7_Click(object sender, EventArgs e)
{
//获取计算机CPU的版本信息
String MyInfo = "计算机CPU的版本信息如下:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("Version: " + MyObject["Version"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button8_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前使用百分比 注意要把SQLserver或者其他耗CPU的软件开着否则看不到效果就一直为0
String MyInfo = "计算机CPU的当前使用百分比是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("LoadPercentage : " + MyObject["LoadPercentage"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button9_Click(object sender, EventArgs e)
{
//获取计算机CPU的最大时钟频率
String MyInfo = "计算机CPU的最大时钟频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("MaxClockSpeed : " + MyObject["MaxClockSpeed"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button10_Click(object sender, EventArgs e)
{
//获取计算机CPU的当前时钟频率
String MyInfo = "计算机CPU的当前时钟频率是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("CurrentClockSpeed : " + MyObject["CurrentClockSpeed"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button11_Click(object sender, EventArgs e)
{
//获取计算机的CPU地址宽度
String MyInfo = "当前计算机的CPU地址宽度是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("AddressWidth: " + MyObject["AddressWidth"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button14_Click(object sender, EventArgs e)
{
//获取计算机的CPU数据宽度
String MyInfo = "当前计算机的CPU数据宽度是:";
ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
foreach (ManagementObject MyObject in MySearcher.Get())
{
MyInfo += "\n" + String.Format("DataWidth : " + MyObject["DataWidth"].ToString());
MyInfo += "\n=========================================================";
}
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
Form1.Designer.cs
namespace WindowsApplication1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(182, 23);
this.button1.TabIndex = 5;
this.button1.Text = "获取CPU编号";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 41);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(186, 23);
this.button2.TabIndex = 17;
this.button2.Text = "获取计算机CPU的当前电压";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(12, 70);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(186, 23);
this.button3.TabIndex = 18;
this.button3.Text = "获取计算机CPU的外部频率";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(12, 99);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(186, 23);
this.button4.TabIndex = 19;
this.button4.Text = "获取计算机CPU的二级缓存";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(12, 128);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(186, 23);
this.button5.TabIndex = 21;
this.button5.Text = "获取计算机CPU的制造商名称";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(204, 157);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(206, 23);
this.button6.TabIndex = 22;
this.button6.Text = "获取计算机CPU的产品名称";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(12, 158);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(186, 23);
this.button7.TabIndex = 23;
this.button7.Text = "获取计算机CPU的版本信息";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(204, 70);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(204, 23);
this.button8.TabIndex = 24;
this.button8.Text = "获取计算机CPU的当前使用百分比";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button9
//
this.button9.Location = new System.Drawing.Point(204, 41);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(204, 23);
this.button9.TabIndex = 25;
this.button9.Text = "获取计算机CPU的最大时钟频率";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(202, 12);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(204, 23);
this.button10.TabIndex = 26;
this.button10.Text = "获取计算机CPU的当前时钟频率";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button11
//
this.button11.Location = new System.Drawing.Point(204, 99);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(204, 23);
this.button11.TabIndex = 27;
this.button11.Text = "获取计算机的CPU地址宽度";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button14
//
this.button14.Location = new System.Drawing.Point(204, 128);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(204, 23);
this.button14.TabIndex = 28;
this.button14.Text = "获取计算机的CPU数据宽度";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 193);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(341, 12);
this.label1.TabIndex = 29;
this.label1.Text = "作者:清清月儿 http://blog.csdn.net/21aspnet/ 2007.3.23";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(422, 214);
this.Controls.Add(this.label1);
this.Controls.Add(this.button14);
this.Controls.Add(this.button11);
this.Controls.Add(this.button10);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Label label1;
}
}
发表评论
-
windows 服务
2010-03-15 14:17 9111> 新建一个windows服务项目 2> ... -
C# 获得搜索引擎 关键字
2010-02-24 10:03 1925using System; using System.Col ... -
在IIS上启用Gzip压缩(HTTP压缩)
2009-10-22 21:31 3395一.摘要 本文总结了如 ... -
集合概述
2009-09-14 10:53 1018集合概述 在编程中,所谓的“集合”其最简单的形式是数组 ... -
C#日期格式化
2009-08-15 11:39 853日期转化一 为了达到不同的显示效果有时,我们需要对时间进行转 ... -
ASP.NET 中获取web.config信息
2009-07-17 15:22 1848.NET 1.1里, using System.Config ... -
C#的Assembly反射机制
2009-06-09 09:50 2377通过C#的Assembly反射机制可以动态的调用一个类以及该类 ... -
string 和String的区别
2009-06-09 09:41 1013MSDN中对的说明: string 类型表示 Unicod ... -
C# API
2009-06-04 10:22 1676C:\ProgramFiles\MicrosoftVisual ...
相关推荐
C# 精髓(美)阿尔巴哈里(Albahari, B.)等编著;刘基诚译 中国电力出版社,2001 文字版PDF,字体永远清晰。可全书关键字查找,方便随时查阅。
C#精髓电子书,pdf高清版,刘基诚译本,C#精髓简明扼要地介绍 C#(读如C Sharp)语言和.NET 框架,使读者能够尽快掌握这项最新的开发技术。但对初学者而言有一定的难度,如果你已经熟悉C++,Smalltalk,Java 或...
C#精髓文字版,非扫描版,仅供参考。。。。。。。。。
如果你想更进一步的,系统的学习C#,那么本书一定对你有所帮助!
C#精髓中文版 前言 第一章 简介 c#语言 clr bcl 第一个c#程序 第二章 c并语言参考 标识符 类型 变量 表达式与运算符 语句 类型组织 继承 访问修饰字 类和结构 接口 数组 枚举 委托...
C#精髓C#精髓C#精髓C#精髓C#精髓C#精髓C#精髓C#精髓
C#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓.rarC#精髓....
c#精髓 davied2004
C#精髓,本书简明扼要地介绍了C#语言和.net框架,使读者能够尽快掌握这项最新的开发技术.刘基译 勾月科技www.gouyue.net 勾月科技QQ17878387
QT095-C#精髓,中国电力出版社,C#是新生事物,没有历史包袱,反映了当前软件开发从面向对象到面向组件、从单独程序到Internet应用,从专有标准到开放标准的新趋势。
本文包含了gridview的大部分常见用法,很有参考价值。
C#精髓--_GridView_72般绝技用过的人都说好,有问题可以私聊我。
一本经典的C#著作,与大家共同进步
详细地介绍了C#语言和.NET框架,使读者能够尽快掌握这项开发技术。
C#语言参考, .net编程框架 对刚学C#的程序员看是不错的,下载看看吧!
C#语言和.net框架
简明介绍C#和.net 框架,可以说精髓是实至名归。
学习C#的好资料,知识面全,可以当是学习的目录,相关知识点都讲到了,不清除的可以网上查资料.
A class file involves common topics of C#.
GridView无代码分页排序 GridView选中,编辑,取消,删除 GridView正反双向排序 GridView和下拉菜单DropDownList结合 GridView和CheckBox结合 鼠标移到GridView某一行时改变该行的背景色方法一 ...