运用API函数获取系统信息(转)

None.gif using  System;
None.gif
using  System.Drawing;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Windows.Forms;
None.gif
using  System.Data;
None.gif
using  System.Runtime.InteropServices;
None.gif
using  System.Text;
None.gif
None.gif
None.gif
namespace  WindowsApplication10
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif 
/**//// <summary>
InBlock.gif 
/// Form1 的摘要说明。
ExpandedSubBlockEnd.gif 
/// </summary>

InBlock.gif public class Form1 : System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif 
dot.gif{
InBlock.gif  
private System.Windows.Forms.GroupBox groupBox1;
InBlock.gif  
private System.Windows.Forms.GroupBox groupBox2;
InBlock.gif  
private System.Windows.Forms.GroupBox groupBox3;
InBlock.gif  
private System.Windows.Forms.GroupBox groupBox4;
InBlock.gif  
private System.Windows.Forms.Button button1;
InBlock.gif  
private System.Windows.Forms.Label AvailVirtual;
InBlock.gif  
private System.Windows.Forms.Label TotalVirtual;
InBlock.gif  
private System.Windows.Forms.Label AvailPageFile;
InBlock.gif  
private System.Windows.Forms.Label TotalPageFile;
InBlock.gif  
private System.Windows.Forms.Label AvailPhys;
InBlock.gif  
private System.Windows.Forms.Label TotalPhys;
InBlock.gif  
private System.Windows.Forms.Label MemoryLoad;
InBlock.gif  
private System.Windows.Forms.Label PageSize;
InBlock.gif  
private System.Windows.Forms.Label OemId;
InBlock.gif  
private System.Windows.Forms.Label ProcessorLevel;
InBlock.gif  
private System.Windows.Forms.Label ProcessorType;
InBlock.gif  
private System.Windows.Forms.Label NumberOfProcessors;
InBlock.gif  
private System.Windows.Forms.Label SystemDirectory;
InBlock.gif  
private System.Windows.Forms.Label WindowsDirectory;
InBlock.gif  
private System.Windows.Forms.Label Time;
InBlock.gif  
private System.Windows.Forms.Label Date;
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// <summary>
InBlock.gif  
/// 必需的设计器变量。
ExpandedSubBlockEnd.gif  
/// </summary>

InBlock.gif  private System.ComponentModel.Container components = null;
InBlock.gif  [DllImport(
"kernel32")] 
InBlock.gif  
public static extern void GetWindowsDirectory(StringBuilder WinDir,int count);
InBlock.gif        
InBlock.gif  [DllImport(
"kernel32")] 
InBlock.gif  
public static extern void GetSystemDirectory(StringBuilder SysDir,int count);
InBlock.gif
InBlock.gif  [DllImport(
"kernel32")] 
InBlock.gif  
public static extern void GetSystemInfo(ref CPU_INFO cpuinfo); 
InBlock.gif
InBlock.gif  [DllImport(
"kernel32")] 
InBlock.gif  
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo); 
InBlock.gif
InBlock.gif  [DllImport(
"kernel32")] 
InBlock.gif  
public static extern void GetSystemTime(ref SYSTEMTIME_INFO stinfo);
InBlock.gif
InBlock.gif  [StructLayout(LayoutKind.Sequential)] 
InBlock.gif   
public struct CPU_INFO 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
public uint dwOemId; 
InBlock.gif   
public uint dwPageSize; 
InBlock.gif   
public uint lpMinimumApplicationAddress; 
InBlock.gif   
public uint lpMaximumApplicationAddress; 
InBlock.gif   
public uint dwActiveProcessorMask; 
InBlock.gif   
public uint dwNumberOfProcessors; 
InBlock.gif   
public uint dwProcessorType; 
InBlock.gif   
public uint dwAllocationGranularity; 
InBlock.gif   
public uint dwProcessorLevel; 
InBlock.gif   
public uint dwProcessorRevision; 
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
//定义内存的信息结构
InBlock.gif
  [StructLayout(LayoutKind.Sequential)] 
InBlock.gif   
public struct MEMORY_INFO 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
public uint dwLength;
InBlock.gif   
public uint dwMemoryLoad; 
InBlock.gif   
public uint dwTotalPhys; 
InBlock.gif   
public uint dwAvailPhys; 
InBlock.gif   
public uint dwTotalPageFile; 
InBlock.gif   
public uint dwAvailPageFile; 
InBlock.gif   
public uint dwTotalVirtual; 
InBlock.gif   
public uint dwAvailVirtual; 
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
//定义系统时间的信息结构
InBlock.gif
  [StructLayout(LayoutKind.Sequential)] 
InBlock.gif   
public struct SYSTEMTIME_INFO 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
public ushort wYear; 
InBlock.gif   
public ushort wMonth; 
InBlock.gif   
public ushort wDayOfWeek; 
InBlock.gif   
public ushort wDay; 
InBlock.gif   
public ushort wHour; 
InBlock.gif   
public ushort wMinute; 
InBlock.gif   
public ushort wSecond; 
InBlock.gif   
public ushort wMilliseconds; 
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
public Form1()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
//
InBlock.gif   
// Windows 窗体设计器支持所必需的
InBlock.gif   
//
InBlock.gif
   InitializeComponent();
InBlock.gif
InBlock.gif   
//
InBlock.gif   
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
InBlock.gif   
//
ExpandedSubBlockEnd.gif
  }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// <summary>
InBlock.gif  
/// 清理所有正在使用的资源。
ExpandedSubBlockEnd.gif  
/// </summary>

InBlock.gif  protected override void Dispose( bool disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
if( disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    
if (components != null
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif     components.Dispose();
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif   }

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

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

InBlock.gif  private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
this.groupBox1 = new System.Windows.Forms.GroupBox();
InBlock.gif   
this.groupBox2 = new System.Windows.Forms.GroupBox();
InBlock.gif   
this.groupBox3 = new System.Windows.Forms.GroupBox();
InBlock.gif   
this.groupBox4 = new System.Windows.Forms.GroupBox();
InBlock.gif   
this.button1 = new System.Windows.Forms.Button();
InBlock.gif   
this.Time = new System.Windows.Forms.Label();
InBlock.gif   
this.Date = new System.Windows.Forms.Label();
InBlock.gif   
this.TotalPhys = new System.Windows.Forms.Label();
InBlock.gif   
this.MemoryLoad = new System.Windows.Forms.Label();
InBlock.gif   
this.AvailPageFile = new System.Windows.Forms.Label();
InBlock.gif   
this.TotalVirtual = new System.Windows.Forms.Label();
InBlock.gif   
this.AvailPhys = new System.Windows.Forms.Label();
InBlock.gif   
this.TotalPageFile = new System.Windows.Forms.Label();
InBlock.gif   
this.PageSize = new System.Windows.Forms.Label();
InBlock.gif   
this.OemId = new System.Windows.Forms.Label();
InBlock.gif   
this.AvailVirtual = new System.Windows.Forms.Label();
InBlock.gif   
this.ProcessorLevel = new System.Windows.Forms.Label();
InBlock.gif   
this.NumberOfProcessors = new System.Windows.Forms.Label();
InBlock.gif   
this.ProcessorType = new System.Windows.Forms.Label();
InBlock.gif   
this.WindowsDirectory = new System.Windows.Forms.Label();
InBlock.gif   
this.SystemDirectory = new System.Windows.Forms.Label();
InBlock.gif   
this.groupBox1.SuspendLayout();
InBlock.gif   
this.groupBox2.SuspendLayout();
InBlock.gif   
this.groupBox3.SuspendLayout();
InBlock.gif   
this.groupBox4.SuspendLayout();
InBlock.gif   
this.SuspendLayout();
InBlock.gif   
// 
InBlock.gif   
// groupBox1
InBlock.gif   
// 
InBlock.gif
   this.groupBox1.Controls.Add(this.Date);
InBlock.gif   
this.groupBox1.Controls.Add(this.Time);
InBlock.gif   
this.groupBox1.Location = new System.Drawing.Point(816);
InBlock.gif   
this.groupBox1.Name = "groupBox1";
InBlock.gif   
this.groupBox1.Size = new System.Drawing.Size(240128);
InBlock.gif   
this.groupBox1.TabIndex = 0;
InBlock.gif   
this.groupBox1.TabStop = false;
InBlock.gif   
this.groupBox1.Text = "groupBox1";
InBlock.gif   
// 
InBlock.gif   
// groupBox2
InBlock.gif   
// 
InBlock.gif
   this.groupBox2.Controls.Add(this.TotalVirtual);
InBlock.gif   
this.groupBox2.Controls.Add(this.AvailVirtual);
InBlock.gif   
this.groupBox2.Location = new System.Drawing.Point(29624);
InBlock.gif   
this.groupBox2.Name = "groupBox2";
InBlock.gif   
this.groupBox2.Size = new System.Drawing.Size(240120);
InBlock.gif   
this.groupBox2.TabIndex = 1;
InBlock.gif   
this.groupBox2.TabStop = false;
InBlock.gif   
this.groupBox2.Text = "groupBox2";
InBlock.gif   
// 
InBlock.gif   
// groupBox3
InBlock.gif   
// 
InBlock.gif
   this.groupBox3.Controls.Add(this.ProcessorType);
InBlock.gif   
this.groupBox3.Controls.Add(this.NumberOfProcessors);
InBlock.gif   
this.groupBox3.Controls.Add(this.MemoryLoad);
InBlock.gif   
this.groupBox3.Controls.Add(this.PageSize);
InBlock.gif   
this.groupBox3.Controls.Add(this.OemId);
InBlock.gif   
this.groupBox3.Controls.Add(this.ProcessorLevel);
InBlock.gif   
this.groupBox3.Location = new System.Drawing.Point(296160);
InBlock.gif   
this.groupBox3.Name = "groupBox3";
InBlock.gif   
this.groupBox3.Size = new System.Drawing.Size(240256);
InBlock.gif   
this.groupBox3.TabIndex = 1;
InBlock.gif   
this.groupBox3.TabStop = false;
InBlock.gif   
this.groupBox3.Text = "groupBox2";
InBlock.gif   
// 
InBlock.gif   
// groupBox4
InBlock.gif   
// 
InBlock.gif
   this.groupBox4.Controls.Add(this.AvailPageFile);
InBlock.gif   
this.groupBox4.Controls.Add(this.TotalPageFile);
InBlock.gif   
this.groupBox4.Controls.Add(this.AvailPhys);
InBlock.gif   
this.groupBox4.Controls.Add(this.TotalPhys);
InBlock.gif   
this.groupBox4.Controls.Add(this.WindowsDirectory);
InBlock.gif   
this.groupBox4.Location = new System.Drawing.Point(16160);
InBlock.gif   
this.groupBox4.Name = "groupBox4";
InBlock.gif   
this.groupBox4.Size = new System.Drawing.Size(240296);
InBlock.gif   
this.groupBox4.TabIndex = 2;
InBlock.gif   
this.groupBox4.TabStop = false;
InBlock.gif   
this.groupBox4.Text = "groupBox2";
InBlock.gif   
// 
InBlock.gif   
// button1
InBlock.gif   
// 
InBlock.gif
   this.button1.Location = new System.Drawing.Point(248456);
InBlock.gif   
this.button1.Name = "button1";
InBlock.gif   
this.button1.TabIndex = 3;
InBlock.gif   
this.button1.Text = "button1";
InBlock.gif   
this.button1.Click += new System.EventHandler(this.button1_Click);
InBlock.gif   
// 
InBlock.gif   
// Time
InBlock.gif   
// 
InBlock.gif
   this.Time.Location = new System.Drawing.Point(3248);
InBlock.gif   
this.Time.Name = "Time";
InBlock.gif   
this.Time.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.Time.TabIndex = 0;
InBlock.gif   
this.Time.Text = "label1";
InBlock.gif   
// 
InBlock.gif   
// Date
InBlock.gif   
// 
InBlock.gif
   this.Date.Location = new System.Drawing.Point(3296);
InBlock.gif   
this.Date.Name = "Date";
InBlock.gif   
this.Date.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.Date.TabIndex = 1;
InBlock.gif   
this.Date.Text = "label2";
InBlock.gif   
// 
InBlock.gif   
// TotalPhys
InBlock.gif   
// 
InBlock.gif
   this.TotalPhys.Location = new System.Drawing.Point(32208);
InBlock.gif   
this.TotalPhys.Name = "TotalPhys";
InBlock.gif   
this.TotalPhys.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.TotalPhys.TabIndex = 2;
InBlock.gif   
this.TotalPhys.Text = "label3";
InBlock.gif   
// 
InBlock.gif   
// MemoryLoad
InBlock.gif   
// 
InBlock.gif
   this.MemoryLoad.Location = new System.Drawing.Point(4056);
InBlock.gif   
this.MemoryLoad.Name = "MemoryLoad";
InBlock.gif   
this.MemoryLoad.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.MemoryLoad.TabIndex = 3;
InBlock.gif   
this.MemoryLoad.Text = "label4";
InBlock.gif   
// 
InBlock.gif   
// AvailPageFile
InBlock.gif   
// 
InBlock.gif
   this.AvailPageFile.Location = new System.Drawing.Point(3264);
InBlock.gif   
this.AvailPageFile.Name = "AvailPageFile";
InBlock.gif   
this.AvailPageFile.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.AvailPageFile.TabIndex = 4;
InBlock.gif   
this.AvailPageFile.Text = "label5";
InBlock.gif   
// 
InBlock.gif   
// TotalVirtual
InBlock.gif   
// 
InBlock.gif
   this.TotalVirtual.Location = new System.Drawing.Point(4040);
InBlock.gif   
this.TotalVirtual.Name = "TotalVirtual";
InBlock.gif   
this.TotalVirtual.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.TotalVirtual.TabIndex = 5;
InBlock.gif   
this.TotalVirtual.Text = "label6";
InBlock.gif   
// 
InBlock.gif   
// AvailPhys
InBlock.gif   
// 
InBlock.gif
   this.AvailPhys.Location = new System.Drawing.Point(32160);
InBlock.gif   
this.AvailPhys.Name = "AvailPhys";
InBlock.gif   
this.AvailPhys.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.AvailPhys.TabIndex = 6;
InBlock.gif   
this.AvailPhys.Text = "label7";
InBlock.gif   
// 
InBlock.gif   
// TotalPageFile
InBlock.gif   
// 
InBlock.gif
   this.TotalPageFile.Location = new System.Drawing.Point(32112);
InBlock.gif   
this.TotalPageFile.Name = "TotalPageFile";
InBlock.gif   
this.TotalPageFile.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.TotalPageFile.TabIndex = 7;
InBlock.gif   
this.TotalPageFile.Text = "label8";
InBlock.gif   
// 
InBlock.gif   
// PageSize
InBlock.gif   
// 
InBlock.gif
   this.PageSize.Location = new System.Drawing.Point(4096);
InBlock.gif   
this.PageSize.Name = "PageSize";
InBlock.gif   
this.PageSize.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.PageSize.TabIndex = 8;
InBlock.gif   
this.PageSize.Text = "label9";
InBlock.gif   
// 
InBlock.gif   
// OemId
InBlock.gif   
// 
InBlock.gif
   this.OemId.Location = new System.Drawing.Point(40144);
InBlock.gif   
this.OemId.Name = "OemId";
InBlock.gif   
this.OemId.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.OemId.TabIndex = 9;
InBlock.gif   
this.OemId.Text = "label10";
InBlock.gif   
// 
InBlock.gif   
// AvailVirtual
InBlock.gif   
// 
InBlock.gif
   this.AvailVirtual.Location = new System.Drawing.Point(4080);
InBlock.gif   
this.AvailVirtual.Name = "AvailVirtual";
InBlock.gif   
this.AvailVirtual.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.AvailVirtual.TabIndex = 10;
InBlock.gif   
this.AvailVirtual.Text = "label11";
InBlock.gif   
// 
InBlock.gif   
// ProcessorLevel
InBlock.gif   
// 
InBlock.gif
   this.ProcessorLevel.Location = new System.Drawing.Point(40184);
InBlock.gif   
this.ProcessorLevel.Name = "ProcessorLevel";
InBlock.gif   
this.ProcessorLevel.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.ProcessorLevel.TabIndex = 11;
InBlock.gif   
this.ProcessorLevel.Text = "label12";
InBlock.gif   
// 
InBlock.gif   
// NumberOfProcessors
InBlock.gif   
// 
InBlock.gif
   this.NumberOfProcessors.Location = new System.Drawing.Point(4024);
InBlock.gif   
this.NumberOfProcessors.Name = "NumberOfProcessors";
InBlock.gif   
this.NumberOfProcessors.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.NumberOfProcessors.TabIndex = 12;
InBlock.gif   
this.NumberOfProcessors.Text = "label1";
InBlock.gif   
// 
InBlock.gif   
// ProcessorType
InBlock.gif   
// 
InBlock.gif
   this.ProcessorType.Location = new System.Drawing.Point(40216);
InBlock.gif   
this.ProcessorType.Name = "ProcessorType";
InBlock.gif   
this.ProcessorType.Size = new System.Drawing.Size(16823);
InBlock.gif   
this.ProcessorType.TabIndex = 13;
InBlock.gif   
this.ProcessorType.Text = "label2";
InBlock.gif   
// 
InBlock.gif   
// WindowsDirectory
InBlock.gif   
// 
InBlock.gif
   this.WindowsDirectory.Location = new System.Drawing.Point(3224);
InBlock.gif   
this.WindowsDirectory.Name = "WindowsDirectory";
InBlock.gif   
this.WindowsDirectory.Size = new System.Drawing.Size(16023);
InBlock.gif   
this.WindowsDirectory.TabIndex = 11;
InBlock.gif   
this.WindowsDirectory.Text = "label1";
InBlock.gif   
// 
InBlock.gif   
// SystemDirectory
InBlock.gif   
// 
InBlock.gif
   this.SystemDirectory.Location = new System.Drawing.Point(32400);
InBlock.gif   
this.SystemDirectory.Name = "SystemDirectory";
InBlock.gif   
this.SystemDirectory.TabIndex = 2;
InBlock.gif   
this.SystemDirectory.Text = "label2";
InBlock.gif   
// 
InBlock.gif   
// Form1
InBlock.gif   
// 
InBlock.gif
   this.AutoScaleBaseSize = new System.Drawing.Size(614);
InBlock.gif   
this.ClientSize = new System.Drawing.Size(568507);
InBlock.gif   
this.Controls.Add(this.button1);
InBlock.gif   
this.Controls.Add(this.groupBox1);
InBlock.gif   
this.Controls.Add(this.groupBox2);
InBlock.gif   
this.Controls.Add(this.groupBox3);
InBlock.gif   
this.Controls.Add(this.groupBox4);
InBlock.gif   
this.Controls.Add(this.SystemDirectory);
InBlock.gif   
this.Name = "Form1";
InBlock.gif   
this.Text = "Form1";
InBlock.gif   
this.groupBox1.ResumeLayout(false);
InBlock.gif   
this.groupBox2.ResumeLayout(false);
InBlock.gif   
this.groupBox3.ResumeLayout(false);
InBlock.gif   
this.groupBox4.ResumeLayout(false);
InBlock.gif   
this.ResumeLayout(false);
InBlock.gif
ExpandedSubBlockEnd.gif  }

ExpandedSubBlockEnd.gif  
#endregion

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// <summary>
InBlock.gif  
/// 应用程序的主入口点。
ExpandedSubBlockEnd.gif  
/// </summary>

InBlock.gif  [STAThread]
InBlock.gif  
static void Main() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   Application.Run(
new Form1());
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
private void button1_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
//调用GetWindowsDirectory和GetSystemDirectory函数分别取得Windows路径和系统路径
InBlock.gif
   const int nChars = 128;
InBlock.gif   StringBuilder Buff 
= new StringBuilder(nChars);
InBlock.gif   GetWindowsDirectory(Buff,nChars);
InBlock.gif   WindowsDirectory.Text 
= "Windows路径:"+Buff.ToString();
InBlock.gif   GetSystemDirectory(Buff,nChars);
InBlock.gif   SystemDirectory.Text 
= "系统路径:"+Buff.ToString();
InBlock.gif
InBlock.gif   
//调用GetSystemInfo函数获取CPU的相关信息
InBlock.gif
   CPU_INFO CpuInfo;
InBlock.gif   CpuInfo 
= new CPU_INFO();
InBlock.gif   GetSystemInfo(
ref CpuInfo);
InBlock.gif   NumberOfProcessors.Text 
= "本计算机中有"+CpuInfo.dwNumberOfProcessors.ToString()+"个CPU";
InBlock.gif   ProcessorType.Text 
= "CPU的类型为"+CpuInfo.dwProcessorType.ToString();
InBlock.gif   ProcessorLevel.Text 
= "CPU等级为"+CpuInfo.dwProcessorLevel.ToString();
InBlock.gif   OemId.Text 
= "CPU的OEM ID为"+CpuInfo.dwOemId.ToString();
InBlock.gif   PageSize.Text 
= "CPU中的页面大小为"+CpuInfo.dwPageSize.ToString();
InBlock.gif
InBlock.gif   
//调用GlobalMemoryStatus函数获取内存的相关信息
InBlock.gif
   MEMORY_INFO MemInfo;
InBlock.gif   MemInfo 
= new MEMORY_INFO();
InBlock.gif   GlobalMemoryStatus(
ref MemInfo);
InBlock.gif   MemoryLoad.Text 
= MemInfo.dwMemoryLoad.ToString()+"%的内存正在使用";
InBlock.gif   TotalPhys.Text 
= "物理内存共有"+MemInfo.dwTotalPhys.ToString()+"字节";
InBlock.gif   AvailPhys.Text 
= "可使用的物理内存有"+MemInfo.dwAvailPhys.ToString()+"字节";
InBlock.gif   TotalPageFile.Text 
= "交换文件总大小为"+MemInfo.dwTotalPageFile.ToString()+"字节";
InBlock.gif   AvailPageFile.Text 
= "尚可交换文件大小为"+MemInfo.dwAvailPageFile.ToString()+"字节";
InBlock.gif   TotalVirtual.Text 
= "总虚拟内存有"+MemInfo.dwTotalVirtual.ToString()+"字节";
InBlock.gif   AvailVirtual.Text 
= "未用虚拟内存有"+MemInfo.dwAvailVirtual.ToString()+"字节";
InBlock.gif
InBlock.gif   
//调用GetSystemTime函数获取系统时间信息
InBlock.gif
   SYSTEMTIME_INFO StInfo;
InBlock.gif   StInfo 
= new SYSTEMTIME_INFO();
InBlock.gif   GetSystemTime(
ref StInfo);
InBlock.gif   Date.Text 
= StInfo.wYear.ToString()+""+StInfo.wMonth.ToString()+""+StInfo.wDay.ToString()+"";
InBlock.gif   Time.Text 
= (StInfo.wHour+8).ToString()+""+StInfo.wMinute.ToString()+""+StInfo.wSecond.ToString()+"";
ExpandedSubBlockEnd.gif  }

InBlock.gif
ExpandedSubBlockEnd.gif  }

ExpandedBlockEnd.gif }

None.gif
None.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值