扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:王凯明 来源:yesky 2007年11月14日
关键字:
![]() |
private void GetInfo_Click(object sender, System.EventArgs e) { //调用GetWindowsDirectory和GetSystemDirectory函数分别取得Windows路径和系统路径 const int nChars = 128; StringBuilder Buff = new StringBuilder(nChars); GetWindowsDirectory(Buff,nChars); WindowsDirectory.Text = "Windows路径:"+Buff.ToString(); GetSystemDirectory(Buff,nChars); SystemDirectory.Text = "系统路径:"+Buff.ToString(); //调用GetSystemInfo函数获取CPU的相关信息 CPU_INFO CpuInfo; CpuInfo = new CPU_INFO(); GetSystemInfo(ref CpuInfo); NumberOfProcessors.Text = "本计算机中有"+CpuInfo.dwNumberOfProcessors.ToString()+"个CPU"; ProcessorType.Text = "CPU的类型为"+CpuInfo.dwProcessorType.ToString(); ProcessorLevel.Text = "CPU等级为"+CpuInfo.dwProcessorLevel.ToString(); OemId.Text = "CPU的OEM ID为"+CpuInfo.dwOemId.ToString(); PageSize.Text = "CPU中的页面大小为"+CpuInfo.dwPageSize.ToString(); //调用GlobalMemoryStatus函数获取内存的相关信息 MEMORY_INFO MemInfo; MemInfo = new MEMORY_INFO(); GlobalMemoryStatus(ref MemInfo); MemoryLoad.Text = MemInfo.dwMemoryLoad.ToString()+"%的内存正在使用"; TotalPhys.Text = "物理内存共有"+MemInfo.dwTotalPhys.ToString()+"字节"; AvailPhys.Text = "可使用的物理内存有"+MemInfo.dwAvailPhys.ToString()+"字节"; TotalPageFile.Text = "交换文件总大小为"+MemInfo.dwTotalPageFile.ToString()+"字节"; AvailPageFile.Text = "尚可交换文件大小为"+MemInfo.dwAvailPageFile.ToString()+"字节"; TotalVirtual.Text = "总虚拟内存有"+MemInfo.dwTotalVirtual.ToString()+"字节"; AvailVirtual.Text = "未用虚拟内存有"+MemInfo.dwAvailVirtual.ToString()+"字节"; //调用GetSystemTime函数获取系统时间信息 SYSTEMTIME_INFO StInfo; StInfo = new SYSTEMTIME_INFO(); GetSystemTime(ref StInfo); Date.Text = StInfo.wYear.ToString()+"年"+StInfo.wMonth.ToString()+"月"+StInfo.wDay.ToString()+"日"; Time.Text = (StInfo.wHour+8).ToString()+"点"+StInfo.wMinute.ToString()+"分"+StInfo.wSecond.ToString()+"秒"; } |
![]() |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。