WMI完美秀出CPU编号厂商主频电压等全部信息-转

首先要添加“引用”一个dll,选择“System Management”;

再引入2个命名空间:
using  System.Management;
using  System.IO;

foreach循环:声明一个迭代变量自动获取数组中每个元素的值。
String.Format:格式化字符,本站就有解释。

ContractedBlock.gif ExpandedBlockStart.gif
  1None.gifForm1.cs
  2None.gif
  3None.gifusing System;
  4None.gifusing System.Collections.Generic;
  5None.gifusing System.ComponentModel;
  6None.gifusing System.Data;
  7None.gifusing System.Drawing;
  8None.gifusing System.Text;
  9None.gifusing System.Windows.Forms;
 10None.gifusing System.Management;
 11None.gifusing System.IO;
 12None.gifnamespace WindowsApplication1
 13ExpandedBlockStart.gifContractedBlock.gifdot.gif{
 14InBlock.gif    public partial class Form1 : Form
 15ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 16InBlock.gif        public Form1()
 17ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 18InBlock.gif            InitializeComponent();
 19ExpandedSubBlockEnd.gif        }

 20InBlock.gif
 21InBlock.gif        private void button1_Click(object sender, EventArgs e)
 22ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 23InBlock.gif            //获取CPU编号
 24InBlock.gif            ManagementClass MyClass = new ManagementClass("Win32_Processor");
 25InBlock.gif            ManagementObjectCollection MyCollection = MyClass.GetInstances();
 26InBlock.gif            String MyInfo = "当前系统CPU编号是:";
 27InBlock.gif            string MyCPUID = "";
 28InBlock.gif            foreach (ManagementObject MyObject in MyCollection)
 29ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 30InBlock.gif                MyCPUID = MyObject.Properties["ProcessorId"].Value.ToString();
 31InBlock.gif                break;
 32ExpandedSubBlockEnd.gif            }

 33InBlock.gif            MyInfo += MyCPUID;
 34InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 35ExpandedSubBlockEnd.gif        }

 36InBlock.gif
 37InBlock.gif        private void button2_Click(object sender, EventArgs e)
 38ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 39InBlock.gif            //获取计算机CPU的当前电压
 40InBlock.gif            String MyInfo = "计算机CPU的当前电压是:";
 41InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
 42InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
 43ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 44InBlock.gif                try
 45ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 46InBlock.gif                    MyInfo += "\n" + String.Format("CurrentVoltage : " + MyObject["CurrentVoltage"].ToString());
 47InBlock.gif                    MyInfo += "\n=========================================================";
 48ExpandedSubBlockEnd.gif                }

 49ExpandedSubBlockStart.gifContractedSubBlock.gif                catch dot.gif{ }
 50ExpandedSubBlockEnd.gif            }

 51InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 52ExpandedSubBlockEnd.gif        }

 53InBlock.gif
 54InBlock.gif        private void button3_Click(object sender, EventArgs e)
 55ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 56InBlock.gif            //获取计算机CPU的外部频率
 57InBlock.gif            String MyInfo = "计算机CPU的外部频率是:";
 58InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
 59InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
 60ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 61InBlock.gif                try
 62ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 63InBlock.gif                    MyInfo += "\n" + String.Format("ExtClock : " + MyObject["ExtClock"].ToString());
 64InBlock.gif                    MyInfo += "\n=========================================================";
 65ExpandedSubBlockEnd.gif                }

 66ExpandedSubBlockStart.gifContractedSubBlock.gif                catch dot.gif{ }
 67ExpandedSubBlockEnd.gif            }

 68InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 69ExpandedSubBlockEnd.gif        }

 70InBlock.gif
 71InBlock.gif        private void button4_Click(object sender, EventArgs e)
 72ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 73InBlock.gif            //获取计算机CPU的二级缓存
 74InBlock.gif            String MyInfo = "计算机CPU的二级缓存尺寸是:";
 75InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
 76InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
 77ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 78InBlock.gif                MyInfo += "\n" + String.Format("L2CacheSize: " + MyObject["L2CacheSize"].ToString());
 79InBlock.gif                MyInfo += "\n=========================================================";
 80ExpandedSubBlockEnd.gif            }

 81InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 82ExpandedSubBlockEnd.gif        }

 83InBlock.gif
 84InBlock.gif        private void button5_Click(object sender, EventArgs e)
 85ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 86InBlock.gif            //获取计算机CPU的制造商名称
 87InBlock.gif            String MyInfo = "计算机CPU的制造商名称是:";
 88InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
 89InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
 90ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 91InBlock.gif                MyInfo += "\n" + String.Format("Manufacturer : " + MyObject["Manufacturer"].ToString());
 92InBlock.gif                MyInfo += "\n=========================================================";
 93ExpandedSubBlockEnd.gif            }

 94InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 95ExpandedSubBlockEnd.gif        }

 96InBlock.gif
 97InBlock.gif        private void button6_Click(object sender, EventArgs e)
 98ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 99InBlock.gif            //获取计算机CPU的产品名称
100InBlock.gif            String MyInfo = "计算机CPU的产品名称是:";
101InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
102InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
103ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
104InBlock.gif                MyInfo += "\n" + String.Format("Name : " + MyObject["Name"].ToString());
105InBlock.gif                MyInfo += "\n=========================================================";
106ExpandedSubBlockEnd.gif            }

107InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
108InBlock.gif
109ExpandedSubBlockEnd.gif        }

110InBlock.gif
111InBlock.gif        private void button7_Click(object sender, EventArgs e)
112ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
113InBlock.gif            //获取计算机CPU的版本信息
114InBlock.gif            String MyInfo = "计算机CPU的版本信息如下:";
115InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
116InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
117ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
118InBlock.gif                MyInfo += "\n" + String.Format("Version: " + MyObject["Version"].ToString());
119InBlock.gif                MyInfo += "\n=========================================================";
120ExpandedSubBlockEnd.gif            }

121InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
122InBlock.gif
123ExpandedSubBlockEnd.gif        }

124InBlock.gif
125InBlock.gif        private void button8_Click(object sender, EventArgs e)
126ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
127InBlock.gif            //获取计算机CPU的当前使用百分比 注意要把SQLserver或者其他耗CPU的软件开着否则看不到效果就一直为0
128InBlock.gif            String MyInfo = "计算机CPU的当前使用百分比是:";
129InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
130InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
131ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
132InBlock.gif                MyInfo += "\n" + String.Format("LoadPercentage : " + MyObject["LoadPercentage"].ToString());
133InBlock.gif                MyInfo += "\n=========================================================";
134ExpandedSubBlockEnd.gif            }

135InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
136InBlock.gif
137ExpandedSubBlockEnd.gif        }

138InBlock.gif
139InBlock.gif        private void button9_Click(object sender, EventArgs e)
140ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
141InBlock.gif            //获取计算机CPU的最大时钟频率
142InBlock.gif            String MyInfo = "计算机CPU的最大时钟频率是:";
143InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
144InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
145ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
146InBlock.gif                MyInfo += "\n" + String.Format("MaxClockSpeed : " + MyObject["MaxClockSpeed"].ToString());
147InBlock.gif                MyInfo += "\n=========================================================";
148ExpandedSubBlockEnd.gif            }

149InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
150InBlock.gif
151ExpandedSubBlockEnd.gif        }

152InBlock.gif
153InBlock.gif        private void button10_Click(object sender, EventArgs e)
154ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
155InBlock.gif            //获取计算机CPU的当前时钟频率
156InBlock.gif            String MyInfo = "计算机CPU的当前时钟频率是:";
157InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
158InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
159ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
160InBlock.gif                MyInfo += "\n" + String.Format("CurrentClockSpeed : " + MyObject["CurrentClockSpeed"].ToString());
161InBlock.gif                MyInfo += "\n=========================================================";
162ExpandedSubBlockEnd.gif            }

163InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
164InBlock.gif
165ExpandedSubBlockEnd.gif        }

166InBlock.gif
167InBlock.gif        private void button11_Click(object sender, EventArgs e)
168ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
169InBlock.gif            //获取计算机的CPU地址宽度
170InBlock.gif            String MyInfo = "当前计算机的CPU地址宽度是:";
171InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
172InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
173ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
174InBlock.gif                MyInfo += "\n" + String.Format("AddressWidth: " + MyObject["AddressWidth"].ToString());
175InBlock.gif                MyInfo += "\n=========================================================";
176ExpandedSubBlockEnd.gif            }

177InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
178InBlock.gif
179ExpandedSubBlockEnd.gif        }

180InBlock.gif
181InBlock.gif        private void button14_Click(object sender, EventArgs e)
182ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
183InBlock.gif            //获取计算机的CPU数据宽度
184InBlock.gif            String MyInfo = "当前计算机的CPU数据宽度是:";
185InBlock.gif            ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
186InBlock.gif            foreach (ManagementObject MyObject in MySearcher.Get())
187ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
188InBlock.gif                MyInfo += "\n" + String.Format("DataWidth : " + MyObject["DataWidth"].ToString());
189InBlock.gif                MyInfo += "\n=========================================================";
190ExpandedSubBlockEnd.gif            }

191InBlock.gif            MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
192InBlock.gif
193ExpandedSubBlockEnd.gif        }

194ExpandedSubBlockEnd.gif    }

195ExpandedBlockEnd.gif}
    
196None.gif
197None.gifForm1.Designer.cs
198None.gif
199None.gifnamespace WindowsApplication1
200ExpandedBlockStart.gifContractedBlock.gifdot.gif{
201InBlock.gif    partial class Form1
202ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
203ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
204InBlock.gif        /// 必需的设计器变量。
205ExpandedSubBlockEnd.gif        /// </summary>

206InBlock.gif        private System.ComponentModel.IContainer components = null;
207InBlock.gif
208ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
209InBlock.gif        /// 清理所有正在使用的资源。
210InBlock.gif        /// </summary>
211ExpandedSubBlockEnd.gif        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>

212InBlock.gif        protected override void Dispose(bool disposing)
213ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
214InBlock.gif            if (disposing && (components != null))
215ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
216InBlock.gif                components.Dispose();
217ExpandedSubBlockEnd.gif            }

218InBlock.gif            base.Dispose(disposing);
219ExpandedSubBlockEnd.gif        }

220InBlock.gif
221ContractedSubBlock.gifExpandedSubBlockStart.gif        Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
222InBlock.gif
223ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
224InBlock.gif        /// 设计器支持所需的方法 - 不要
225InBlock.gif        /// 使用代码编辑器修改此方法的内容。
226ExpandedSubBlockEnd.gif        /// </summary>

227InBlock.gif        private void InitializeComponent()
228ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
229InBlock.gif            this.button1 = new System.Windows.Forms.Button();
230InBlock.gif            this.button2 = new System.Windows.Forms.Button();
231InBlock.gif            this.button3 = new System.Windows.Forms.Button();
232InBlock.gif            this.button4 = new System.Windows.Forms.Button();
233InBlock.gif            this.button5 = new System.Windows.Forms.Button();
234InBlock.gif            this.button6 = new System.Windows.Forms.Button();
235InBlock.gif            this.button7 = new System.Windows.Forms.Button();
236InBlock.gif            this.button8 = new System.Windows.Forms.Button();
237InBlock.gif            this.button9 = new System.Windows.Forms.Button();
238InBlock.gif            this.button10 = new System.Windows.Forms.Button();
239InBlock.gif            this.button11 = new System.Windows.Forms.Button();
240InBlock.gif            this.button14 = new System.Windows.Forms.Button();
241InBlock.gif            this.label1 = new System.Windows.Forms.Label();
242InBlock.gif            this.SuspendLayout();
243InBlock.gif            // 
244InBlock.gif            // button1
245InBlock.gif            // 
246InBlock.gif            this.button1.Location = new System.Drawing.Point(1212);
247InBlock.gif            this.button1.Name = "button1";
248InBlock.gif            this.button1.Size = new System.Drawing.Size(18223);
249InBlock.gif            this.button1.TabIndex = 5;
250InBlock.gif            this.button1.Text = "获取CPU编号";
251InBlock.gif            this.button1.UseVisualStyleBackColor = true;
252InBlock.gif            this.button1.Click += new System.EventHandler(this.button1_Click);
253InBlock.gif            // 
254InBlock.gif            // button2
255InBlock.gif            // 
256InBlock.gif            this.button2.Location = new System.Drawing.Point(1241);
257InBlock.gif            this.button2.Name = "button2";
258InBlock.gif            this.button2.Size = new System.Drawing.Size(18623);
259InBlock.gif            this.button2.TabIndex = 17;
260InBlock.gif            this.button2.Text = "获取计算机CPU的当前电压";
261InBlock.gif            this.button2.UseVisualStyleBackColor = true;
262InBlock.gif            this.button2.Click += new System.EventHandler(this.button2_Click);
263InBlock.gif            // 
264InBlock.gif            // button3
265InBlock.gif            // 
266InBlock.gif            this.button3.Location = new System.Drawing.Point(1270);
267InBlock.gif            this.button3.Name = "button3";
268InBlock.gif            this.button3.Size = new System.Drawing.Size(18623);
269InBlock.gif            this.button3.TabIndex = 18;
270InBlock.gif            this.button3.Text = "获取计算机CPU的外部频率";
271InBlock.gif            this.button3.UseVisualStyleBackColor = true;
272InBlock.gif            this.button3.Click += new System.EventHandler(this.button3_Click);
273InBlock.gif            // 
274InBlock.gif            // button4
275InBlock.gif            // 
276InBlock.gif            this.button4.Location = new System.Drawing.Point(1299);
277InBlock.gif            this.button4.Name = "button4";
278InBlock.gif            this.button4.Size = new System.Drawing.Size(18623);
279InBlock.gif            this.button4.TabIndex = 19;
280InBlock.gif            this.button4.Text = "获取计算机CPU的二级缓存";
281InBlock.gif            this.button4.UseVisualStyleBackColor = true;
282InBlock.gif            this.button4.Click += new System.EventHandler(this.button4_Click);
283InBlock.gif            // 
284InBlock.gif            // button5
285InBlock.gif            // 
286InBlock.gif            this.button5.Location = new System.Drawing.Point(12128);
287InBlock.gif            this.button5.Name = "button5";
288InBlock.gif            this.button5.Size = new System.Drawing.Size(18623);
289InBlock.gif            this.button5.TabIndex = 21;
290InBlock.gif            this.button5.Text = "获取计算机CPU的制造商名称";
291InBlock.gif            this.button5.UseVisualStyleBackColor = true;
292InBlock.gif            this.button5.Click += new System.EventHandler(this.button5_Click);
293InBlock.gif            // 
294InBlock.gif            // button6
295InBlock.gif            // 
296InBlock.gif            this.button6.Location = new System.Drawing.Point(204157);
297InBlock.gif            this.button6.Name = "button6";
298InBlock.gif            this.button6.Size = new System.Drawing.Size(20623);
299InBlock.gif            this.button6.TabIndex = 22;
300InBlock.gif            this.button6.Text = "获取计算机CPU的产品名称";
301InBlock.gif            this.button6.UseVisualStyleBackColor = true;
302InBlock.gif            this.button6.Click += new System.EventHandler(this.button6_Click);
303InBlock.gif            // 
304InBlock.gif            // button7
305InBlock.gif            // 
306InBlock.gif            this.button7.Location = new System.Drawing.Point(12158);
307InBlock.gif            this.button7.Name = "button7";
308InBlock.gif            this.button7.Size = new System.Drawing.Size(18623);
309InBlock.gif            this.button7.TabIndex = 23;
310InBlock.gif            this.button7.Text = "获取计算机CPU的版本信息";
311InBlock.gif            this.button7.UseVisualStyleBackColor = true;
312InBlock.gif            this.button7.Click += new System.EventHandler(this.button7_Click);
313InBlock.gif            // 
314InBlock.gif            // button8
315InBlock.gif            // 
316InBlock.gif            this.button8.Location = new System.Drawing.Point(20470);
317InBlock.gif            this.button8.Name = "button8";
318InBlock.gif            this.button8.Size = new System.Drawing.Size(20423);
319InBlock.gif            this.button8.TabIndex = 24;
320InBlock.gif            this.button8.Text = "获取计算机CPU的当前使用百分比";
321InBlock.gif            this.button8.UseVisualStyleBackColor = true;
322InBlock.gif            this.button8.Click += new System.EventHandler(this.button8_Click);
323InBlock.gif            // 
324InBlock.gif            // button9
325InBlock.gif            // 
326InBlock.gif            this.button9.Location = new System.Drawing.Point(20441);
327InBlock.gif            this.button9.Name = "button9";
328InBlock.gif            this.button9.Size = new System.Drawing.Size(20423);
329InBlock.gif            this.button9.TabIndex = 25;
330InBlock.gif            this.button9.Text = "获取计算机CPU的最大时钟频率";
331InBlock.gif            this.button9.UseVisualStyleBackColor = true;
332InBlock.gif            this.button9.Click += new System.EventHandler(this.button9_Click);
333InBlock.gif            // 
334InBlock.gif            // button10
335InBlock.gif            // 
336InBlock.gif            this.button10.Location = new System.Drawing.Point(20212);
337InBlock.gif            this.button10.Name = "button10";
338InBlock.gif            this.button10.Size = new System.Drawing.Size(20423);
339InBlock.gif            this.button10.TabIndex = 26;
340InBlock.gif            this.button10.Text = "获取计算机CPU的当前时钟频率";
341InBlock.gif            this.button10.UseVisualStyleBackColor = true;
342InBlock.gif            this.button10.Click += new System.EventHandler(this.button10_Click);
343InBlock.gif            // 
344InBlock.gif            // button11
345InBlock.gif            // 
346InBlock.gif            this.button11.Location = new System.Drawing.Point(20499);
347InBlock.gif            this.button11.Name = "button11";
348InBlock.gif            this.button11.Size = new System.Drawing.Size(20423);
349InBlock.gif            this.button11.TabIndex = 27;
350InBlock.gif            this.button11.Text = "获取计算机的CPU地址宽度";
351InBlock.gif            this.button11.UseVisualStyleBackColor = true;
352InBlock.gif            this.button11.Click += new System.EventHandler(this.button11_Click);
353InBlock.gif            // 
354InBlock.gif            // button14
355InBlock.gif            // 
356InBlock.gif            this.button14.Location = new System.Drawing.Point(204128);
357InBlock.gif            this.button14.Name = "button14";
358InBlock.gif            this.button14.Size = new System.Drawing.Size(20423);
359InBlock.gif            this.button14.TabIndex = 28;
360InBlock.gif            this.button14.Text = "获取计算机的CPU数据宽度";
361InBlock.gif            this.button14.UseVisualStyleBackColor = true;
362InBlock.gif            this.button14.Click += new System.EventHandler(this.button14_Click);
363InBlock.gif            // 
364InBlock.gif            // label1
365InBlock.gif            // 
366InBlock.gif            this.label1.AutoSize = true;
367InBlock.gif            this.label1.Location = new System.Drawing.Point(15193);
368InBlock.gif            this.label1.Name = "label1";
369InBlock.gif            this.label1.Size = new System.Drawing.Size(34112);
370InBlock.gif            this.label1.TabIndex = 29;
371InBlock.gif            this.label1.Text = "作者:清清月儿 http://blog.csdn.net/21aspnet/  2007.3.23";
372InBlock.gif            // 
373InBlock.gif            // Form1
374InBlock.gif            // 
375InBlock.gif            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
376InBlock.gif            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
377InBlock.gif            this.ClientSize = new System.Drawing.Size(422214);
378InBlock.gif            this.Controls.Add(this.label1);
379InBlock.gif            this.Controls.Add(this.button14);
380InBlock.gif            this.Controls.Add(this.button11);
381InBlock.gif            this.Controls.Add(this.button10);
382InBlock.gif            this.Controls.Add(this.button9);
383InBlock.gif            this.Controls.Add(this.button8);
384InBlock.gif            this.Controls.Add(this.button7);
385InBlock.gif            this.Controls.Add(this.button6);
386InBlock.gif            this.Controls.Add(this.button5);
387InBlock.gif            this.Controls.Add(this.button4);
388InBlock.gif            this.Controls.Add(this.button3);
389InBlock.gif            this.Controls.Add(this.button2);
390InBlock.gif            this.Controls.Add(this.button1);
391InBlock.gif            this.Name = "Form1";
392InBlock.gif            this.Text = "Form1";
393InBlock.gif            this.ResumeLayout(false);
394InBlock.gif            this.PerformLayout();
395InBlock.gif
396ExpandedSubBlockEnd.gif        }

397InBlock.gif
398ExpandedSubBlockEnd.gif        #endregion

399InBlock.gif
400InBlock.gif        private System.Windows.Forms.Button button1;
401InBlock.gif        private System.Windows.Forms.Button button2;
402InBlock.gif        private System.Windows.Forms.Button button3;
403InBlock.gif        private System.Windows.Forms.Button button4;
404InBlock.gif        private System.Windows.Forms.Button button5;
405InBlock.gif        private System.Windows.Forms.Button button6;
406InBlock.gif        private System.Windows.Forms.Button button7;
407InBlock.gif        private System.Windows.Forms.Button button8;
408InBlock.gif        private System.Windows.Forms.Button button9;
409InBlock.gif        private System.Windows.Forms.Button button10;
410InBlock.gif        private System.Windows.Forms.Button button11;
411InBlock.gif        private System.Windows.Forms.Button button14;
412InBlock.gif        private System.Windows.Forms.Label label1;
413ExpandedSubBlockEnd.gif    }

414ExpandedBlockEnd.gif}

415None.gif
416None.gif
第二个
None.gif CpuInfo.cs
None.gif
None.gif
using  System;
None.gif
using  System.Configuration;
None.gif
using  System.Runtime.InteropServices;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /**
InBlock.gif * LayoutKind.Automatic:为了提高效率允许运行态对类型成员重新排序
InBlock.gif * 注意:永远不要使用这个选项来调用不受管辖的动态链接库函数。
InBlock.gif * LayoutKind.Explicit:对每个域按照FieldOffset属性对类型成员排序
InBlock.gif * LayoutKind.Sequential:对出现在受管辖类型定义地方的不受管辖内存中的类型成员进行排序。
ExpandedBlockEnd.gif 
*/

None.gif 
ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /// <summary>
InBlock.gif
/// 定义CPU的信息结构
ExpandedBlockEnd.gif
/// </summary>

None.gif [StructLayout(LayoutKind.Sequential)] 
None.gif
public   struct  CpuInfo
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// OEM ID
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwOemId;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 页面大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwPageSize;
InBlock.gif    
public uint lpMinimumApplicationAddress;
InBlock.gif    
public uint lpMaximumApplicationAddress;
InBlock.gif    
public uint dwActiveProcessorMask;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// CPU个数
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwNumberOfProcessors;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// CPU类型
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwProcessorType;
InBlock.gif    
public uint dwAllocationGranularity;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// CPU等级
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwProcessorLevel;
InBlock.gif    
public uint dwProcessorRevision; 
ExpandedBlockEnd.gif}

None.gifMemoryInfo.cs
None.gif
using  System;
None.gif
using  System.Configuration;
None.gif
using  System.Runtime.InteropServices;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /**
InBlock.gif * LayoutKind.Automatic:为了提高效率允许运行态对类型成员重新排序
InBlock.gif * 注意:永远不要使用这个选项来调用不受管辖的动态链接库函数。
InBlock.gif * LayoutKind.Explicit:对每个域按照FieldOffset属性对类型成员排序
InBlock.gif * LayoutKind.Sequential:对出现在受管辖类型定义地方的不受管辖内存中的类型成员进行排序。
ExpandedBlockEnd.gif 
*/

ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /// <summary>
InBlock.gif
/// 定义内存的信息结构
ExpandedBlockEnd.gif
/// </summary>

None.gif [StructLayout(LayoutKind.Sequential)]
None.gif
public   struct  MemoryInfo
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwLength;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 已经使用的内存
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwMemoryLoad;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 总物理内存大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwTotalPhys;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 可用物理内存大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwAvailPhys;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 交换文件总大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwTotalPageFile;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 可用交换文件大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwAvailPageFile;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 总虚拟内存大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwTotalVirtual;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 可用虚拟内存大小
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public uint dwAvailVirtual;
ExpandedBlockEnd.gif}

None.gifSystemTimeInfo.cs
None.gif
using  System;
None.gif
using  System.Configuration;
None.gif
using  System.Runtime.InteropServices;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /**
InBlock.gif * LayoutKind.Automatic:为了提高效率允许运行态对类型成员重新排序
InBlock.gif * 注意:永远不要使用这个选项来调用不受管辖的动态链接库函数。
InBlock.gif * LayoutKind.Explicit:对每个域按照FieldOffset属性对类型成员排序
InBlock.gif * LayoutKind.Sequential:对出现在受管辖类型定义地方的不受管辖内存中的类型成员进行排序。
ExpandedBlockEnd.gif 
*/

ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /// <summary>
InBlock.gif
/// 定义系统时间的信息结构
ExpandedBlockEnd.gif
/// </summary>

None.gif [StructLayout(LayoutKind.Sequential)] 
None.gif
public   struct  SystemTimeInfo
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 年
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wYear;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 月
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wMonth;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 星期
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wDayOfWeek;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 天
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wDay;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 小时
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wHour;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 分钟
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wMinute;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 秒
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wSecond;
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 毫秒
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public ushort wMilliseconds;
ExpandedBlockEnd.gif}

None.gif另外还定义了一个调用类SystemInfo.cs,代码如下:
None.gif
using  System;
None.gif
using  System.Configuration;
None.gif
using  System.Runtime.InteropServices;
None.gif
using  System.Management;
None.gif
using  System.Text;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /**/ /**/ /// <summary>
InBlock.gif
/// SystemInfo 的摘要说明
ExpandedBlockEnd.gif
/// </summary>

None.gif public   class  SystemInfo
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
InBlock.gif    
private const int CHAR_COUNT = 128;
InBlock.gif    
public SystemInfo()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
ExpandedSubBlockEnd.gif    }

InBlock.gif    [DllImport(
"kernel32")]
InBlock.gif    
private static extern void GetWindowsDirectory(StringBuilder WinDir, int count);
InBlock.gif
InBlock.gif    [DllImport(
"kernel32")]
InBlock.gif    
private static extern void GetSystemDirectory(StringBuilder SysDir, int count);
InBlock.gif
InBlock.gif    [DllImport(
"kernel32")]
InBlock.gif    
private static extern void GetSystemInfo(ref CpuInfo cpuInfo);
InBlock.gif
InBlock.gif    [DllImport(
"kernel32")]
InBlock.gif    
private static extern void GlobalMemoryStatus(ref MemoryInfo memInfo);
InBlock.gif
InBlock.gif    [DllImport(
"kernel32")]
InBlock.gif    
private static extern void GetSystemTime(ref SystemTimeInfo sysInfo);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 查询CPU编号
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public string GetCpuId()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        ManagementClass mClass 
= new ManagementClass("Win32_Processor");
InBlock.gif        ManagementObjectCollection moc 
= mClass.GetInstances();
InBlock.gif        
string cpuId=null;
InBlock.gif        
foreach (ManagementObject mo in moc)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            cpuId 
= mo.Properties["ProcessorId"].Value.ToString();
InBlock.gif            
break;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
return cpuId;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 查询硬盘编号
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public string GetMainHardDiskId()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        ManagementObjectSearcher searcher 
= new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
InBlock.gif        String hardDiskID
=null;
InBlock.gif        
foreach (ManagementObject mo in searcher.Get())
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            hardDiskID 
= mo["SerialNumber"].ToString().Trim();
InBlock.gif            
break;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
return hardDiskID; 
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 获取Windows目录
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public string GetWinDirectory()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        StringBuilder sBuilder 
= new StringBuilder(CHAR_COUNT);
InBlock.gif        GetWindowsDirectory(sBuilder, CHAR_COUNT);
InBlock.gif        
return sBuilder.ToString();
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 获取系统目录
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public string GetSysDirectory()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        StringBuilder sBuilder 
= new StringBuilder(CHAR_COUNT);
InBlock.gif        GetSystemDirectory(sBuilder, CHAR_COUNT);
InBlock.gif        
return sBuilder.ToString();
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif   
/**//**//**//// <summary>
InBlock.gif   
/// 获取CPU信息
InBlock.gif   
/// </summary>
ExpandedSubBlockEnd.gif   
/// <returns></returns>

InBlock.gif    public CpuInfo GetCpuInfo()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        CpuInfo cpuInfo 
= new CpuInfo();
InBlock.gif        GetSystemInfo(
ref cpuInfo);
InBlock.gif        
return cpuInfo;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 获取系统内存信息
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public MemoryInfo GetMemoryInfo()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        MemoryInfo memoryInfo 
= new MemoryInfo();
InBlock.gif        GlobalMemoryStatus(
ref memoryInfo);
InBlock.gif        
return memoryInfo;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 获取系统时间信息
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public SystemTimeInfo GetSystemTimeInfo()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        SystemTimeInfo systemTimeInfo 
= new SystemTimeInfo();
InBlock.gif        GetSystemTime(
ref systemTimeInfo);
InBlock.gif        
return systemTimeInfo;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//**//**//// <summary>
InBlock.gif    
/// 获取系统名称
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <returns></returns>

InBlock.gif    public string GetOperationSystemInName()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        OperatingSystem os 
= System.Environment.OSVersion;
InBlock.gif        
string osName = "UNKNOWN";
InBlock.gif        
switch (os.Platform)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            
case PlatformID.Win32Windows:
InBlock.gif                
switch (os.Version.Minor)
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    
case 0: osName = "Windows 95"break;
InBlock.gif                    
case 10: osName = "Windows 98"break;
InBlock.gif                    
case 90: osName = "Windows ME"break;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
break;
InBlock.gif            
case PlatformID.Win32NT:
InBlock.gif                
switch (os.Version.Major)
ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif
dot.gif{
InBlock.gif                    
case 3: osName = "Windws NT 3.51"break;
InBlock.gif                    
case 4: osName = "Windows NT 4"break;
InBlock.gif                    
case 5if (os.Version.Minor == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif
dot.gif{
InBlock.gif                            osName 
= "Windows 2000"
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else if (os.Version.Minor == 1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif
dot.gif{
InBlock.gif                            osName 
= "Windows XP"
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else if (os.Version.Minor == 2)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif
dot.gif{
InBlock.gif                            osName 
= "Windows Server 2003"
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
break;
InBlock.gif                    
case 6: osName = "Longhorn"break;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
break;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
return String.Format("{0},{1}", osName, os.Version.ToString());
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif以下是调用实例,为了简单,我在一个aspx页面中输出,不过这个程序可以在WinForm中调用:
None.gif
using  System;
None.gif
using  System.Data;
None.gif
using  System.Configuration;
None.gif
using  System.Collections;
None.gif
using  System.Collections.Specialized;
None.gif
using  System.Web;
None.gif
using  System.Web.Security;
None.gif
using  System.Web.UI;
None.gif
using  System.Web.UI.WebControls;
None.gif
using  System.Web.UI.WebControls.WebParts;
None.gif
using  System.Web.UI.HtmlControls;
None.gif
using  System.Runtime.InteropServices;
None.gif
None.gif
public  partial  class  Index : System.Web.UI.Page
ExpandedBlockStart.gifContractedBlock.gifdot.gif
dot.gif {
InBlock.gif    
protected void Page_Load(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif
dot.gif{
InBlock.gif        
if (!Page.IsPostBack)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif
dot.gif{
InBlock.gif            SystemInfo systemInfo 
= new SystemInfo();
InBlock.gif             Response.Write(
"操作系统:" + systemInfo.GetOperationSystemInName() + "<br/>");
InBlock.gif            Response.Write(
"CPU编号:"+systemInfo.GetCpuId() + "<br/>");
InBlock.gif            Response.Write(
"硬盘编号:"+systemInfo.GetMainHardDiskId() + "<br/>");
InBlock.gif            Response.Write(
"Windows目录所在位置:" + systemInfo.GetSysDirectory() + "<br/>");
InBlock.gif            Response.Write(
"系统目录所在位置:" + systemInfo.GetWinDirectory() + "<br/>");
InBlock.gif            MemoryInfo memoryInfo 
= systemInfo.GetMemoryInfo();
InBlock.gif            CpuInfo cpuInfo 
= systemInfo.GetCpuInfo();
InBlock.gif            Response.Write(
"dwActiveProcessorMask" + cpuInfo.dwActiveProcessorMask + "<br/>");
InBlock.gif            Response.Write(
"dwAllocationGranularity" + cpuInfo.dwAllocationGranularity + "<br/>");
InBlock.gif            Response.Write(
"CPU个数:" + cpuInfo.dwNumberOfProcessors + "<br/>");
InBlock.gif            Response.Write(
"OEM ID:" + cpuInfo.dwOemId + "<br/>");
InBlock.gif            Response.Write(
"页面大小" + cpuInfo.dwPageSize + "<br/>");
InBlock.gif            Response.Write(
"CPU等级" + cpuInfo.dwProcessorLevel + "<br/>");
InBlock.gif            Response.Write(
"dwProcessorRevision" + cpuInfo.dwProcessorRevision + "<br/>");
InBlock.gif            Response.Write(
"CPU类型" + cpuInfo.dwProcessorType + "<br/>");
InBlock.gif            Response.Write(
"lpMaximumApplicationAddress" + cpuInfo.lpMaximumApplicationAddress + "<br/>");
InBlock.gif            Response.Write(
"lpMinimumApplicationAddress" + cpuInfo.lpMinimumApplicationAddress + "<br/>");
InBlock.gif            Response.Write(
"CPU类型:" + cpuInfo.dwProcessorType + "<br/>");
InBlock.gif            Response.Write(
"可用交换文件大小:" + memoryInfo.dwAvailPageFile + "<br/>");
InBlock.gif            Response.Write(
"可用物理内存大小:" + memoryInfo.dwAvailPhys + "<br/>");
InBlock.gif            Response.Write(
"可用虚拟内存大小" + memoryInfo.dwAvailVirtual + "<br/>");
InBlock.gif            Response.Write(
"操作系统位数:" + memoryInfo.dwLength + "<br/>");
InBlock.gif            Response.Write(
"已经使用内存大小:" + memoryInfo.dwMemoryLoad + "<br/>");
InBlock.gif            Response.Write(
"交换文件总大小:" + memoryInfo.dwTotalPageFile + "<br/>");
InBlock.gif            Response.Write(
"总物理内存大小:" + memoryInfo.dwTotalPhys + "<br/>");
InBlock.gif            Response.Write(
"总虚拟内存大小:" + memoryInfo.dwTotalVirtual + "<br/>");
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

转载于:https://www.cnblogs.com/whitetiger/archive/2007/03/25/687569.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值