Example #1
0
 private void 系统信息ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SystemInfo systemInfo = new SystemInfo();
        CpuInfo cpuInfo = systemInfo.GetCpuInfo();
        MemoryInfo memoryInfo = systemInfo.GetMemoryInfo();
        SystemTimeInfo systemTimeInfo=systemInfo.GetSystemTimeInfo();
        label1.Text += "计算机名 :" + GetComputerName() + "\r\n";
        label1.Text += "用户名 :" + GetUserName() + "\r\n";
        label1.Text += "操作系统:" + systemInfo.GetOperationSystemInName() + "\r\n";
        label1.Text += "CPU编号:" + systemInfo.GetCpuId() + "\r\n";
        label1.Text += "CPU个数:" + cpuInfo.dwNumberOfProcessors + "\r\n";
        label1.Text += "CPU类型:" + cpuInfo.dwProcessorType + "\r\n";
        label1.Text += "CPU等级:" + cpuInfo.dwProcessorLevel + "\r\n";
        label1.Text += "页面大小: " + cpuInfo.dwPageSize + " 字节" + "\r\n";
        label1.Text += "操作系统位数:" + memoryInfo.dwLength +" 位"+ "\r\n";
        label1.Text += "可用物理内存大小:" + memoryInfo.dwAvailPhys + " 字节" + "\r\n";
        label1.Text += "可用虚拟内存大小" + memoryInfo.dwAvailVirtual + " 字节" + "\r\n";
        label1.Text += "已经使用内存大小:" + memoryInfo.dwMemoryLoad + " 字节" + "\r\n";
        label1.Text += "总物理内存大小:" + memoryInfo.dwTotalPhys + " 字节" + "\r\n";
        label1.Text += "总虚拟内存大小:" + memoryInfo.dwTotalVirtual + " 字节" + "\r\n";
        label1.Text += "Windows目录所在位置:" + systemInfo.GetSysDirectory() + "\r\n";
        label1.Text += "系统目录所在位置:" + systemInfo.GetWinDirectory() + "\r\n";
        label1.Text += "系统时间: " + systemTimeInfo.wYear + "年 " + systemTimeInfo.wMonth + "月 " + systemTimeInfo.wDay + "日 " + (systemTimeInfo.wHour+8) + ":" + systemTimeInfo.wMinute + "\r\n";
 }