 
                    
                
         
    
    
    
 
	 
		 
		
	
		
		
			
 using System;
using System;
 using System.Drawing;
using System.Drawing;
 using System.Collections;
using System.Collections;
 using System.ComponentModel;
using System.ComponentModel;
 using System.Windows.Forms;
using System.Windows.Forms;
 using System.Data;
using System.Data;
 using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
 using System.Text;
using System.Text;


 namespace WindowsApplication10
namespace WindowsApplication10


 {
{

 /**//// <summary>
 /**//// <summary>
 /// Form1 的摘要说明。
 /// Form1 的摘要说明。
 /// </summary>
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 public class Form1 : System.Windows.Forms.Form

 
  {
{
 private System.Windows.Forms.GroupBox groupBox1;
  private System.Windows.Forms.GroupBox groupBox1;
 private System.Windows.Forms.GroupBox groupBox2;
  private System.Windows.Forms.GroupBox groupBox2;
 private System.Windows.Forms.GroupBox groupBox3;
  private System.Windows.Forms.GroupBox groupBox3;
 private System.Windows.Forms.GroupBox groupBox4;
  private System.Windows.Forms.GroupBox groupBox4;
 private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Button button1;
 private System.Windows.Forms.Label AvailVirtual;
  private System.Windows.Forms.Label AvailVirtual;
 private System.Windows.Forms.Label TotalVirtual;
  private System.Windows.Forms.Label TotalVirtual;
 private System.Windows.Forms.Label AvailPageFile;
  private System.Windows.Forms.Label AvailPageFile;
 private System.Windows.Forms.Label TotalPageFile;
  private System.Windows.Forms.Label TotalPageFile;
 private System.Windows.Forms.Label AvailPhys;
  private System.Windows.Forms.Label AvailPhys;
 private System.Windows.Forms.Label TotalPhys;
  private System.Windows.Forms.Label TotalPhys;
 private System.Windows.Forms.Label MemoryLoad;
  private System.Windows.Forms.Label MemoryLoad;
 private System.Windows.Forms.Label PageSize;
  private System.Windows.Forms.Label PageSize;
 private System.Windows.Forms.Label OemId;
  private System.Windows.Forms.Label OemId;
 private System.Windows.Forms.Label ProcessorLevel;
  private System.Windows.Forms.Label ProcessorLevel;
 private System.Windows.Forms.Label ProcessorType;
  private System.Windows.Forms.Label ProcessorType;
 private System.Windows.Forms.Label NumberOfProcessors;
  private System.Windows.Forms.Label NumberOfProcessors;
 private System.Windows.Forms.Label SystemDirectory;
  private System.Windows.Forms.Label SystemDirectory;
 private System.Windows.Forms.Label WindowsDirectory;
  private System.Windows.Forms.Label WindowsDirectory;
 private System.Windows.Forms.Label Time;
  private System.Windows.Forms.Label Time;
 private System.Windows.Forms.Label Date;
  private System.Windows.Forms.Label Date;

 /**//// <summary>
  /**//// <summary>
 /// 必需的设计器变量。
  /// 必需的设计器变量。
 /// </summary>
  /// </summary>
 private System.ComponentModel.Container components = null;
  private System.ComponentModel.Container components = null;
 [DllImport("kernel32")]
  [DllImport("kernel32")] 
 public static extern void GetWindowsDirectory(StringBuilder WinDir,int count);
  public static extern void GetWindowsDirectory(StringBuilder WinDir,int count);
 
        
 [DllImport("kernel32")]
  [DllImport("kernel32")] 
 public static extern void GetSystemDirectory(StringBuilder SysDir,int count);
  public static extern void GetSystemDirectory(StringBuilder SysDir,int count);

 [DllImport("kernel32")]
  [DllImport("kernel32")] 
 public static extern void GetSystemInfo(ref CPU_INFO cpuinfo);
  public static extern void GetSystemInfo(ref CPU_INFO cpuinfo); 

 [DllImport("kernel32")]
  [DllImport("kernel32")] 
 public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
  public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo); 

 [DllImport("kernel32")]
  [DllImport("kernel32")] 
 public static extern void GetSystemTime(ref SYSTEMTIME_INFO stinfo);
  public static extern void GetSystemTime(ref SYSTEMTIME_INFO stinfo);

 [StructLayout(LayoutKind.Sequential)]
  [StructLayout(LayoutKind.Sequential)] 
 public struct CPU_INFO
   public struct CPU_INFO 

 
   {
{ 
 public uint dwOemId;
   public uint dwOemId; 
 public uint dwPageSize;
   public uint dwPageSize; 
 public uint lpMinimumApplicationAddress;
   public uint lpMinimumApplicationAddress; 
 public uint lpMaximumApplicationAddress;
   public uint lpMaximumApplicationAddress; 
 public uint dwActiveProcessorMask;
   public uint dwActiveProcessorMask; 
 public uint dwNumberOfProcessors;
   public uint dwNumberOfProcessors; 
 public uint dwProcessorType;
   public uint dwProcessorType; 
 public uint dwAllocationGranularity;
   public uint dwAllocationGranularity; 
 public uint dwProcessorLevel;
   public uint dwProcessorLevel; 
 public uint dwProcessorRevision;
   public uint dwProcessorRevision; 
 }
  }

 //定义内存的信息结构
  //定义内存的信息结构
 [StructLayout(LayoutKind.Sequential)]
  [StructLayout(LayoutKind.Sequential)] 
 public struct MEMORY_INFO
   public struct MEMORY_INFO 

 
   {
{
 public uint dwLength;
   public uint dwLength;
 public uint dwMemoryLoad;
   public uint dwMemoryLoad; 
 public uint dwTotalPhys;
   public uint dwTotalPhys; 
 public uint dwAvailPhys;
   public uint dwAvailPhys; 
 public uint dwTotalPageFile;
   public uint dwTotalPageFile; 
 public uint dwAvailPageFile;
   public uint dwAvailPageFile; 
 public uint dwTotalVirtual;
   public uint dwTotalVirtual; 
 public uint dwAvailVirtual;
   public uint dwAvailVirtual; 
 }
  }

 //定义系统时间的信息结构
  //定义系统时间的信息结构
 [StructLayout(LayoutKind.Sequential)]
  [StructLayout(LayoutKind.Sequential)] 
 public struct SYSTEMTIME_INFO
   public struct SYSTEMTIME_INFO 

 
   {
{ 
 public ushort wYear;
   public ushort wYear; 
 public ushort wMonth;
   public ushort wMonth; 
 public ushort wDayOfWeek;
   public ushort wDayOfWeek; 
 public ushort wDay;
   public ushort wDay; 
 public ushort wHour;
   public ushort wHour; 
 public ushort wMinute;
   public ushort wMinute; 
 public ushort wSecond;
   public ushort wSecond; 
 public ushort wMilliseconds;
   public ushort wMilliseconds; 
 }
  }

 public Form1()
  public Form1()

 
   {
{
 //
   //
 // Windows 窗体设计器支持所必需的
   // Windows 窗体设计器支持所必需的
 //
   //
 InitializeComponent();
   InitializeComponent();

 //
   //
 // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
 //
   //
 }
  }


 /**//// <summary>
  /**//// <summary>
 /// 清理所有正在使用的资源。
  /// 清理所有正在使用的资源。
 /// </summary>
  /// </summary>
 protected override void Dispose( bool disposing )
  protected override void Dispose( bool disposing )

 
   {
{
 if( disposing )
   if( disposing )

 
    {
{
 if (components != null)
    if (components != null) 

 
     {
{
 components.Dispose();
     components.Dispose();
 }
    }
 }
   }
 base.Dispose( disposing );
   base.Dispose( disposing );
 }
  }


 Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
  Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码

 /**//// <summary>
  /**//// <summary>
 /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
 /// 此方法的内容。
  /// 此方法的内容。
 /// </summary>
  /// </summary>
 private void InitializeComponent()
  private void InitializeComponent()

 
   {
{
 this.groupBox1 = new System.Windows.Forms.GroupBox();
   this.groupBox1 = new System.Windows.Forms.GroupBox();
 this.groupBox2 = new System.Windows.Forms.GroupBox();
   this.groupBox2 = new System.Windows.Forms.GroupBox();
 this.groupBox3 = new System.Windows.Forms.GroupBox();
   this.groupBox3 = new System.Windows.Forms.GroupBox();
 this.groupBox4 = new System.Windows.Forms.GroupBox();
   this.groupBox4 = new System.Windows.Forms.GroupBox();
 this.button1 = new System.Windows.Forms.Button();
   this.button1 = new System.Windows.Forms.Button();
 this.Time = new System.Windows.Forms.Label();
   this.Time = new System.Windows.Forms.Label();
 this.Date = new System.Windows.Forms.Label();
   this.Date = new System.Windows.Forms.Label();
 this.TotalPhys = new System.Windows.Forms.Label();
   this.TotalPhys = new System.Windows.Forms.Label();
 this.MemoryLoad = new System.Windows.Forms.Label();
   this.MemoryLoad = new System.Windows.Forms.Label();
 this.AvailPageFile = new System.Windows.Forms.Label();
   this.AvailPageFile = new System.Windows.Forms.Label();
 this.TotalVirtual = new System.Windows.Forms.Label();
   this.TotalVirtual = new System.Windows.Forms.Label();
 this.AvailPhys = new System.Windows.Forms.Label();
   this.AvailPhys = new System.Windows.Forms.Label();
 this.TotalPageFile = new System.Windows.Forms.Label();
   this.TotalPageFile = new System.Windows.Forms.Label();
 this.PageSize = new System.Windows.Forms.Label();
   this.PageSize = new System.Windows.Forms.Label();
 this.OemId = new System.Windows.Forms.Label();
   this.OemId = new System.Windows.Forms.Label();
 this.AvailVirtual = new System.Windows.Forms.Label();
   this.AvailVirtual = new System.Windows.Forms.Label();
 this.ProcessorLevel = new System.Windows.Forms.Label();
   this.ProcessorLevel = new System.Windows.Forms.Label();
 this.NumberOfProcessors = new System.Windows.Forms.Label();
   this.NumberOfProcessors = new System.Windows.Forms.Label();
 this.ProcessorType = new System.Windows.Forms.Label();
   this.ProcessorType = new System.Windows.Forms.Label();
 this.WindowsDirectory = new System.Windows.Forms.Label();
   this.WindowsDirectory = new System.Windows.Forms.Label();
 this.SystemDirectory = new System.Windows.Forms.Label();
   this.SystemDirectory = new System.Windows.Forms.Label();
 this.groupBox1.SuspendLayout();
   this.groupBox1.SuspendLayout();
 this.groupBox2.SuspendLayout();
   this.groupBox2.SuspendLayout();
 this.groupBox3.SuspendLayout();
   this.groupBox3.SuspendLayout();
 this.groupBox4.SuspendLayout();
   this.groupBox4.SuspendLayout();
 this.SuspendLayout();
   this.SuspendLayout();
 //
   // 
 // groupBox1
   // groupBox1
 //
   // 
 this.groupBox1.Controls.Add(this.Date);
   this.groupBox1.Controls.Add(this.Date);
 this.groupBox1.Controls.Add(this.Time);
   this.groupBox1.Controls.Add(this.Time);
 this.groupBox1.Location = new System.Drawing.Point(8, 16);
   this.groupBox1.Location = new System.Drawing.Point(8, 16);
 this.groupBox1.Name = "groupBox1";
   this.groupBox1.Name = "groupBox1";
 this.groupBox1.Size = new System.Drawing.Size(240, 128);
   this.groupBox1.Size = new System.Drawing.Size(240, 128);
 this.groupBox1.TabIndex = 0;
   this.groupBox1.TabIndex = 0;
 this.groupBox1.TabStop = false;
   this.groupBox1.TabStop = false;
 this.groupBox1.Text = "groupBox1";
   this.groupBox1.Text = "groupBox1";
 //
   // 
 // groupBox2
   // groupBox2
 //
   // 
 this.groupBox2.Controls.Add(this.TotalVirtual);
   this.groupBox2.Controls.Add(this.TotalVirtual);
 this.groupBox2.Controls.Add(this.AvailVirtual);
   this.groupBox2.Controls.Add(this.AvailVirtual);
 this.groupBox2.Location = new System.Drawing.Point(296, 24);
   this.groupBox2.Location = new System.Drawing.Point(296, 24);
 this.groupBox2.Name = "groupBox2";
   this.groupBox2.Name = "groupBox2";
 this.groupBox2.Size = new System.Drawing.Size(240, 120);
   this.groupBox2.Size = new System.Drawing.Size(240, 120);
 this.groupBox2.TabIndex = 1;
   this.groupBox2.TabIndex = 1;
 this.groupBox2.TabStop = false;
   this.groupBox2.TabStop = false;
 this.groupBox2.Text = "groupBox2";
   this.groupBox2.Text = "groupBox2";
 //
   // 
 // groupBox3
   // groupBox3
 //
   // 
 this.groupBox3.Controls.Add(this.ProcessorType);
   this.groupBox3.Controls.Add(this.ProcessorType);
 this.groupBox3.Controls.Add(this.NumberOfProcessors);
   this.groupBox3.Controls.Add(this.NumberOfProcessors);
 this.groupBox3.Controls.Add(this.MemoryLoad);
   this.groupBox3.Controls.Add(this.MemoryLoad);
 this.groupBox3.Controls.Add(this.PageSize);
   this.groupBox3.Controls.Add(this.PageSize);
 this.groupBox3.Controls.Add(this.OemId);
   this.groupBox3.Controls.Add(this.OemId);
 this.groupBox3.Controls.Add(this.ProcessorLevel);
   this.groupBox3.Controls.Add(this.ProcessorLevel);
 this.groupBox3.Location = new System.Drawing.Point(296, 160);
   this.groupBox3.Location = new System.Drawing.Point(296, 160);
 this.groupBox3.Name = "groupBox3";
   this.groupBox3.Name = "groupBox3";
 this.groupBox3.Size = new System.Drawing.Size(240, 256);
   this.groupBox3.Size = new System.Drawing.Size(240, 256);
 this.groupBox3.TabIndex = 1;
   this.groupBox3.TabIndex = 1;
 this.groupBox3.TabStop = false;
   this.groupBox3.TabStop = false;
 this.groupBox3.Text = "groupBox2";
   this.groupBox3.Text = "groupBox2";
 //
   // 
 // groupBox4
   // groupBox4
 //
   // 
 this.groupBox4.Controls.Add(this.AvailPageFile);
   this.groupBox4.Controls.Add(this.AvailPageFile);
 this.groupBox4.Controls.Add(this.TotalPageFile);
   this.groupBox4.Controls.Add(this.TotalPageFile);
 this.groupBox4.Controls.Add(this.AvailPhys);
   this.groupBox4.Controls.Add(this.AvailPhys);
 this.groupBox4.Controls.Add(this.TotalPhys);
   this.groupBox4.Controls.Add(this.TotalPhys);
 this.groupBox4.Controls.Add(this.WindowsDirectory);
   this.groupBox4.Controls.Add(this.WindowsDirectory);
 this.groupBox4.Location = new System.Drawing.Point(16, 160);
   this.groupBox4.Location = new System.Drawing.Point(16, 160);
 this.groupBox4.Name = "groupBox4";
   this.groupBox4.Name = "groupBox4";
 this.groupBox4.Size = new System.Drawing.Size(240, 296);
   this.groupBox4.Size = new System.Drawing.Size(240, 296);
 this.groupBox4.TabIndex = 2;
   this.groupBox4.TabIndex = 2;
 this.groupBox4.TabStop = false;
   this.groupBox4.TabStop = false;
 this.groupBox4.Text = "groupBox2";
   this.groupBox4.Text = "groupBox2";
 //
   // 
 // button1
   // button1
 //
   // 
 this.button1.Location = new System.Drawing.Point(248, 456);
   this.button1.Location = new System.Drawing.Point(248, 456);
 this.button1.Name = "button1";
   this.button1.Name = "button1";
 this.button1.TabIndex = 3;
   this.button1.TabIndex = 3;
 this.button1.Text = "button1";
   this.button1.Text = "button1";
 this.button1.Click += new System.EventHandler(this.button1_Click);
   this.button1.Click += new System.EventHandler(this.button1_Click);
 //
   // 
 // Time
   // Time
 //
   // 
 this.Time.Location = new System.Drawing.Point(32, 48);
   this.Time.Location = new System.Drawing.Point(32, 48);
 this.Time.Name = "Time";
   this.Time.Name = "Time";
 this.Time.Size = new System.Drawing.Size(160, 23);
   this.Time.Size = new System.Drawing.Size(160, 23);
 this.Time.TabIndex = 0;
   this.Time.TabIndex = 0;
 this.Time.Text = "label1";
   this.Time.Text = "label1";
 //
   // 
 // Date
   // Date
 //
   // 
 this.Date.Location = new System.Drawing.Point(32, 96);
   this.Date.Location = new System.Drawing.Point(32, 96);
 this.Date.Name = "Date";
   this.Date.Name = "Date";
 this.Date.Size = new System.Drawing.Size(160, 23);
   this.Date.Size = new System.Drawing.Size(160, 23);
 this.Date.TabIndex = 1;
   this.Date.TabIndex = 1;
 this.Date.Text = "label2";
   this.Date.Text = "label2";
 //
   // 
 // TotalPhys
   // TotalPhys
 //
   // 
 this.TotalPhys.Location = new System.Drawing.Point(32, 208);
   this.TotalPhys.Location = new System.Drawing.Point(32, 208);
 this.TotalPhys.Name = "TotalPhys";
   this.TotalPhys.Name = "TotalPhys";
 this.TotalPhys.Size = new System.Drawing.Size(160, 23);
   this.TotalPhys.Size = new System.Drawing.Size(160, 23);
 this.TotalPhys.TabIndex = 2;
   this.TotalPhys.TabIndex = 2;
 this.TotalPhys.Text = "label3";
   this.TotalPhys.Text = "label3";
 //
   // 
 // MemoryLoad
   // MemoryLoad
 //
   // 
 this.MemoryLoad.Location = new System.Drawing.Point(40, 56);
   this.MemoryLoad.Location = new System.Drawing.Point(40, 56);
 this.MemoryLoad.Name = "MemoryLoad";
   this.MemoryLoad.Name = "MemoryLoad";
 this.MemoryLoad.Size = new System.Drawing.Size(168, 23);
   this.MemoryLoad.Size = new System.Drawing.Size(168, 23);
 this.MemoryLoad.TabIndex = 3;
   this.MemoryLoad.TabIndex = 3;
 this.MemoryLoad.Text = "label4";
   this.MemoryLoad.Text = "label4";
 //
   // 
 // AvailPageFile
   // AvailPageFile
 //
   // 
 this.AvailPageFile.Location = new System.Drawing.Point(32, 64);
   this.AvailPageFile.Location = new System.Drawing.Point(32, 64);
 this.AvailPageFile.Name = "AvailPageFile";
   this.AvailPageFile.Name = "AvailPageFile";
 this.AvailPageFile.Size = new System.Drawing.Size(160, 23);
   this.AvailPageFile.Size = new System.Drawing.Size(160, 23);
 this.AvailPageFile.TabIndex = 4;
   this.AvailPageFile.TabIndex = 4;
 this.AvailPageFile.Text = "label5";
   this.AvailPageFile.Text = "label5";
 //
   // 
 // TotalVirtual
   // TotalVirtual
 //
   // 
 this.TotalVirtual.Location = new System.Drawing.Point(40, 40);
   this.TotalVirtual.Location = new System.Drawing.Point(40, 40);
 this.TotalVirtual.Name = "TotalVirtual";
   this.TotalVirtual.Name = "TotalVirtual";
 this.TotalVirtual.Size = new System.Drawing.Size(168, 23);
   this.TotalVirtual.Size = new System.Drawing.Size(168, 23);
 this.TotalVirtual.TabIndex = 5;
   this.TotalVirtual.TabIndex = 5;
 this.TotalVirtual.Text = "label6";
   this.TotalVirtual.Text = "label6";
 //
   // 
 // AvailPhys
   // AvailPhys
 //
   // 
 this.AvailPhys.Location = new System.Drawing.Point(32, 160);
   this.AvailPhys.Location = new System.Drawing.Point(32, 160);
 this.AvailPhys.Name = "AvailPhys";
   this.AvailPhys.Name = "AvailPhys";
 this.AvailPhys.Size = new System.Drawing.Size(160, 23);
   this.AvailPhys.Size = new System.Drawing.Size(160, 23);
 this.AvailPhys.TabIndex = 6;
   this.AvailPhys.TabIndex = 6;
 this.AvailPhys.Text = "label7";
   this.AvailPhys.Text = "label7";
 //
   // 
 // TotalPageFile
   // TotalPageFile
 //
   // 
 this.TotalPageFile.Location = new System.Drawing.Point(32, 112);
   this.TotalPageFile.Location = new System.Drawing.Point(32, 112);
 this.TotalPageFile.Name = "TotalPageFile";
   this.TotalPageFile.Name = "TotalPageFile";
 this.TotalPageFile.Size = new System.Drawing.Size(160, 23);
   this.TotalPageFile.Size = new System.Drawing.Size(160, 23);
 this.TotalPageFile.TabIndex = 7;
   this.TotalPageFile.TabIndex = 7;
 this.TotalPageFile.Text = "label8";
   this.TotalPageFile.Text = "label8";
 //
   // 
 // PageSize
   // PageSize
 //
   // 
 this.PageSize.Location = new System.Drawing.Point(40, 96);
   this.PageSize.Location = new System.Drawing.Point(40, 96);
 this.PageSize.Name = "PageSize";
   this.PageSize.Name = "PageSize";
 this.PageSize.Size = new System.Drawing.Size(168, 23);
   this.PageSize.Size = new System.Drawing.Size(168, 23);
 this.PageSize.TabIndex = 8;
   this.PageSize.TabIndex = 8;
 this.PageSize.Text = "label9";
   this.PageSize.Text = "label9";
 //
   // 
 // OemId
   // OemId
 //
   // 
 this.OemId.Location = new System.Drawing.Point(40, 144);
   this.OemId.Location = new System.Drawing.Point(40, 144);
 this.OemId.Name = "OemId";
   this.OemId.Name = "OemId";
 this.OemId.Size = new System.Drawing.Size(168, 23);
   this.OemId.Size = new System.Drawing.Size(168, 23);
 this.OemId.TabIndex = 9;
   this.OemId.TabIndex = 9;
 this.OemId.Text = "label10";
   this.OemId.Text = "label10";
 //
   // 
 // AvailVirtual
   // AvailVirtual
 //
   // 
 this.AvailVirtual.Location = new System.Drawing.Point(40, 80);
   this.AvailVirtual.Location = new System.Drawing.Point(40, 80);
 this.AvailVirtual.Name = "AvailVirtual";
   this.AvailVirtual.Name = "AvailVirtual";
 this.AvailVirtual.Size = new System.Drawing.Size(168, 23);
   this.AvailVirtual.Size = new System.Drawing.Size(168, 23);
 this.AvailVirtual.TabIndex = 10;
   this.AvailVirtual.TabIndex = 10;
 this.AvailVirtual.Text = "label11";
   this.AvailVirtual.Text = "label11";
 //
   // 
 // ProcessorLevel
   // ProcessorLevel
 //
   // 
 this.ProcessorLevel.Location = new System.Drawing.Point(40, 184);
   this.ProcessorLevel.Location = new System.Drawing.Point(40, 184);
 this.ProcessorLevel.Name = "ProcessorLevel";
   this.ProcessorLevel.Name = "ProcessorLevel";
 this.ProcessorLevel.Size = new System.Drawing.Size(168, 23);
   this.ProcessorLevel.Size = new System.Drawing.Size(168, 23);
 this.ProcessorLevel.TabIndex = 11;
   this.ProcessorLevel.TabIndex = 11;
 this.ProcessorLevel.Text = "label12";
   this.ProcessorLevel.Text = "label12";
 //
   // 
 // NumberOfProcessors
   // NumberOfProcessors
 //
   // 
 this.NumberOfProcessors.Location = new System.Drawing.Point(40, 24);
   this.NumberOfProcessors.Location = new System.Drawing.Point(40, 24);
 this.NumberOfProcessors.Name = "NumberOfProcessors";
   this.NumberOfProcessors.Name = "NumberOfProcessors";
 this.NumberOfProcessors.Size = new System.Drawing.Size(168, 23);
   this.NumberOfProcessors.Size = new System.Drawing.Size(168, 23);
 this.NumberOfProcessors.TabIndex = 12;
   this.NumberOfProcessors.TabIndex = 12;
 this.NumberOfProcessors.Text = "label1";
   this.NumberOfProcessors.Text = "label1";
 //
   // 
 // ProcessorType
   // ProcessorType
 //
   // 
 this.ProcessorType.Location = new System.Drawing.Point(40, 216);
   this.ProcessorType.Location = new System.Drawing.Point(40, 216);
 this.ProcessorType.Name = "ProcessorType";
   this.ProcessorType.Name = "ProcessorType";
 this.ProcessorType.Size = new System.Drawing.Size(168, 23);
   this.ProcessorType.Size = new System.Drawing.Size(168, 23);
 this.ProcessorType.TabIndex = 13;
   this.ProcessorType.TabIndex = 13;
 this.ProcessorType.Text = "label2";
   this.ProcessorType.Text = "label2";
 //
   // 
 // WindowsDirectory
   // WindowsDirectory
 //
   // 
 this.WindowsDirectory.Location = new System.Drawing.Point(32, 24);
   this.WindowsDirectory.Location = new System.Drawing.Point(32, 24);
 this.WindowsDirectory.Name = "WindowsDirectory";
   this.WindowsDirectory.Name = "WindowsDirectory";
 this.WindowsDirectory.Size = new System.Drawing.Size(160, 23);
   this.WindowsDirectory.Size = new System.Drawing.Size(160, 23);
 this.WindowsDirectory.TabIndex = 11;
   this.WindowsDirectory.TabIndex = 11;
 this.WindowsDirectory.Text = "label1";
   this.WindowsDirectory.Text = "label1";
 //
   // 
 // SystemDirectory
   // SystemDirectory
 //
   // 
 this.SystemDirectory.Location = new System.Drawing.Point(32, 400);
   this.SystemDirectory.Location = new System.Drawing.Point(32, 400);
 this.SystemDirectory.Name = "SystemDirectory";
   this.SystemDirectory.Name = "SystemDirectory";
 this.SystemDirectory.TabIndex = 2;
   this.SystemDirectory.TabIndex = 2;
 this.SystemDirectory.Text = "label2";
   this.SystemDirectory.Text = "label2";
 //
   // 
 // Form1
   // Form1
 //
   // 
 this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
 this.ClientSize = new System.Drawing.Size(568, 507);
   this.ClientSize = new System.Drawing.Size(568, 507);
 this.Controls.Add(this.button1);
   this.Controls.Add(this.button1);
 this.Controls.Add(this.groupBox1);
   this.Controls.Add(this.groupBox1);
 this.Controls.Add(this.groupBox2);
   this.Controls.Add(this.groupBox2);
 this.Controls.Add(this.groupBox3);
   this.Controls.Add(this.groupBox3);
 this.Controls.Add(this.groupBox4);
   this.Controls.Add(this.groupBox4);
 this.Controls.Add(this.SystemDirectory);
   this.Controls.Add(this.SystemDirectory);
 this.Name = "Form1";
   this.Name = "Form1";
 this.Text = "Form1";
   this.Text = "Form1";
 this.groupBox1.ResumeLayout(false);
   this.groupBox1.ResumeLayout(false);
 this.groupBox2.ResumeLayout(false);
   this.groupBox2.ResumeLayout(false);
 this.groupBox3.ResumeLayout(false);
   this.groupBox3.ResumeLayout(false);
 this.groupBox4.ResumeLayout(false);
   this.groupBox4.ResumeLayout(false);
 this.ResumeLayout(false);
   this.ResumeLayout(false);

 }
  }
 #endregion
  #endregion


 /**//// <summary>
  /**//// <summary>
 /// 应用程序的主入口点。
  /// 应用程序的主入口点。
 /// </summary>
  /// </summary>
 [STAThread]
  [STAThread]
 static void Main()
  static void Main() 

 
   {
{
 Application.Run(new Form1());
   Application.Run(new Form1());
 }
  }

 private void button1_Click(object sender, System.EventArgs e)
  private void button1_Click(object sender, System.EventArgs e)

 
   {
{
 //调用GetWindowsDirectory和GetSystemDirectory函数分别取得Windows路径和系统路径
   //调用GetWindowsDirectory和GetSystemDirectory函数分别取得Windows路径和系统路径
 const int nChars = 128;
   const int nChars = 128;
 StringBuilder Buff = new StringBuilder(nChars);
   StringBuilder Buff = new StringBuilder(nChars);
 GetWindowsDirectory(Buff,nChars);
   GetWindowsDirectory(Buff,nChars);
 WindowsDirectory.Text = "Windows路径:"+Buff.ToString();
   WindowsDirectory.Text = "Windows路径:"+Buff.ToString();
 GetSystemDirectory(Buff,nChars);
   GetSystemDirectory(Buff,nChars);
 SystemDirectory.Text = "系统路径:"+Buff.ToString();
   SystemDirectory.Text = "系统路径:"+Buff.ToString();

 //调用GetSystemInfo函数获取CPU的相关信息
   //调用GetSystemInfo函数获取CPU的相关信息
 CPU_INFO CpuInfo;
   CPU_INFO CpuInfo;
 CpuInfo = new CPU_INFO();
   CpuInfo = new CPU_INFO();
 GetSystemInfo(ref CpuInfo);
   GetSystemInfo(ref CpuInfo);
 NumberOfProcessors.Text = "本计算机中有"+CpuInfo.dwNumberOfProcessors.ToString()+"个CPU";
   NumberOfProcessors.Text = "本计算机中有"+CpuInfo.dwNumberOfProcessors.ToString()+"个CPU";
 ProcessorType.Text = "CPU的类型为"+CpuInfo.dwProcessorType.ToString();
   ProcessorType.Text = "CPU的类型为"+CpuInfo.dwProcessorType.ToString();
 ProcessorLevel.Text = "CPU等级为"+CpuInfo.dwProcessorLevel.ToString();
   ProcessorLevel.Text = "CPU等级为"+CpuInfo.dwProcessorLevel.ToString();
 OemId.Text = "CPU的OEM ID为"+CpuInfo.dwOemId.ToString();
   OemId.Text = "CPU的OEM ID为"+CpuInfo.dwOemId.ToString();
 PageSize.Text = "CPU中的页面大小为"+CpuInfo.dwPageSize.ToString();
   PageSize.Text = "CPU中的页面大小为"+CpuInfo.dwPageSize.ToString();

 //调用GlobalMemoryStatus函数获取内存的相关信息
   //调用GlobalMemoryStatus函数获取内存的相关信息
 MEMORY_INFO MemInfo;
   MEMORY_INFO MemInfo;
 MemInfo = new MEMORY_INFO();
   MemInfo = new MEMORY_INFO();
 GlobalMemoryStatus(ref MemInfo);
   GlobalMemoryStatus(ref MemInfo);
 MemoryLoad.Text = MemInfo.dwMemoryLoad.ToString()+"%的内存正在使用";
   MemoryLoad.Text = MemInfo.dwMemoryLoad.ToString()+"%的内存正在使用";
 TotalPhys.Text = "物理内存共有"+MemInfo.dwTotalPhys.ToString()+"字节";
   TotalPhys.Text = "物理内存共有"+MemInfo.dwTotalPhys.ToString()+"字节";
 AvailPhys.Text = "可使用的物理内存有"+MemInfo.dwAvailPhys.ToString()+"字节";
   AvailPhys.Text = "可使用的物理内存有"+MemInfo.dwAvailPhys.ToString()+"字节";
 TotalPageFile.Text = "交换文件总大小为"+MemInfo.dwTotalPageFile.ToString()+"字节";
   TotalPageFile.Text = "交换文件总大小为"+MemInfo.dwTotalPageFile.ToString()+"字节";
 AvailPageFile.Text = "尚可交换文件大小为"+MemInfo.dwAvailPageFile.ToString()+"字节";
   AvailPageFile.Text = "尚可交换文件大小为"+MemInfo.dwAvailPageFile.ToString()+"字节";
 TotalVirtual.Text = "总虚拟内存有"+MemInfo.dwTotalVirtual.ToString()+"字节";
   TotalVirtual.Text = "总虚拟内存有"+MemInfo.dwTotalVirtual.ToString()+"字节";
 AvailVirtual.Text = "未用虚拟内存有"+MemInfo.dwAvailVirtual.ToString()+"字节";
   AvailVirtual.Text = "未用虚拟内存有"+MemInfo.dwAvailVirtual.ToString()+"字节";

 //调用GetSystemTime函数获取系统时间信息
   //调用GetSystemTime函数获取系统时间信息
 SYSTEMTIME_INFO StInfo;
   SYSTEMTIME_INFO StInfo;
 StInfo = new SYSTEMTIME_INFO();
   StInfo = new SYSTEMTIME_INFO();
 GetSystemTime(ref StInfo);
   GetSystemTime(ref StInfo);
 Date.Text = StInfo.wYear.ToString()+"年"+StInfo.wMonth.ToString()+"月"+StInfo.wDay.ToString()+"日";
   Date.Text = StInfo.wYear.ToString()+"年"+StInfo.wMonth.ToString()+"月"+StInfo.wDay.ToString()+"日";
 Time.Text = (StInfo.wHour+8).ToString()+"点"+StInfo.wMinute.ToString()+"分"+StInfo.wSecond.ToString()+"秒";
   Time.Text = (StInfo.wHour+8).ToString()+"点"+StInfo.wMinute.ToString()+"分"+StInfo.wSecond.ToString()+"秒";
 }
  }

 }
  }
 }
 }


 
		 
		posted @ 
2006-02-21 15:49 
jhtchina 
阅读(
662) 
评论() 
 
收藏 
举报