vb.netcpuid的简单介绍
VB.NET怎么编程测试CPU电压
'
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于网站设计、成都网站建设、浙江网络推广、小程序设计、浙江网络营销、浙江企业策划、浙江品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联建站为所有大学生创业者提供浙江建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com
'!!!重要:首先要添加“引用”一个dll,选择“System Management”;
'
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Management
Imports System.IO
Namespace WindowsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取CPU编号
Dim [MyClass] As New ManagementClass("Win32_Processor")
Dim MyCollection As ManagementObjectCollection = [MyClass].GetInstances()
Dim MyInfo As String = "当前系统CPU编号是:"
Dim MyCPUID As String = ""
For Each MyObject As ManagementObject In MyCollection
MyCPUID = MyObject.Properties("ProcessorId").Value.ToString()
Exit For
Next MyObject
MyInfo = MyCPUID
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的当前电压
Dim MyInfo As String = "计算机CPU的当前电压是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
Try
MyInfo = ControlChars.Lf String.Format("CurrentVoltage : " MyObject("CurrentVoltage").ToString())
MyInfo = ControlChars.Lf "========================================================="
Catch
End Try
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的外部频率
Dim MyInfo As String = "计算机CPU的外部频率是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
Try
MyInfo = ControlChars.Lf String.Format("ExtClock : " MyObject("ExtClock").ToString())
MyInfo = ControlChars.Lf "========================================================="
Catch
End Try
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button4_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的二级缓存
Dim MyInfo As String = "计算机CPU的二级缓存尺寸是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("L2CacheSize: " MyObject("L2CacheSize").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button5_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的制造商名称
Dim MyInfo As String = "计算机CPU的制造商名称是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("Manufacturer : " MyObject("Manufacturer").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button6_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的产品名称
Dim MyInfo As String = "计算机CPU的产品名称是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("Name : " MyObject("Name").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button7_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的版本信息
Dim MyInfo As String = "计算机CPU的版本信息如下:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("Version: " MyObject("Version").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button8_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的当前使用百分比 注意要把SQLserver或者其他耗CPU的软件开着否则看不到效果就一直为0
Dim MyInfo As String = "计算机CPU的当前使用百分比是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("LoadPercentage : " MyObject("LoadPercentage").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button9_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的最大时钟频率
Dim MyInfo As String = "计算机CPU的最大时钟频率是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("MaxClockSpeed : " MyObject("MaxClockSpeed").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button10_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机CPU的当前时钟频率
Dim MyInfo As String = "计算机CPU的当前时钟频率是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("CurrentClockSpeed : " MyObject("CurrentClockSpeed").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button11_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机的CPU地址宽度
Dim MyInfo As String = "当前计算机的CPU地址宽度是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("AddressWidth: " MyObject("AddressWidth").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub button14_Click(ByVal sender As Object, ByVal e As EventArgs)
'获取计算机的CPU数据宽度
Dim MyInfo As String = "当前计算机的CPU数据宽度是:"
Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
For Each MyObject As ManagementObject In MySearcher.Get()
MyInfo = ControlChars.Lf String.Format("DataWidth : " MyObject("DataWidth").ToString())
MyInfo = ControlChars.Lf "========================================================="
Next MyObject
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class
vb.net 获得CPU位数的代码?
CPU位数获取不了,核心数可以,能够用程序侦测出的,可以点我的电脑,右键属性
VB.NET,部分机器获取不了CPU号(高分急用)
VB 我不熟,下面是用汇编写的,我运行过可以的。
//--------------------------------
.model small
.586
.stack
.code
idstring db 49 dup('$')
start:
mov ax,@code
mov ds,ax
lea di,idstring
mov eax,80000002h
cpuid
mov dword ptr [di],eax
mov dword ptr [di+4],ebx
mov dword ptr [di+8],ecx
mov dword ptr [di+12],edx
mov eax,80000003h
cpuid
mov dword ptr [di+16],eax
mov dword ptr [di+20],ebx
mov dword ptr [di+24],ecx
mov dword ptr [di+28],edx
mov eax,80000004h
cpuid
mov dword ptr [di+32],eax
mov dword ptr [di+36],ebx
mov dword ptr [di+40],ecx
mov dword ptr [di+44],edx
mov ah,09h
lea dx,idstring
int 21h
mov ah,4ch
int 21h
end start
//-------------------------------------------------------
程序确实可以执行,输出CPU的ID等信息。
注意:DOS下或MS-DOS下使用。
vb.net如何获取当前进程的cpu和内存使用率?
使用wmi
类“Win32_Processor”中LoadPercentage属性为当前的cpu使用率
示例代码: Private Sub Timer1_Timer()
Dim WMI服务 As Object
Dim 对象 As Object
Dim 子对象 As Object
Dim 电脑名 As String
Dim 刷新 As Long
刷新 = 0
电脑名 = "." '表示本地计算机
Set WMI服务 = GetObject("winmgmts://" 电脑名 "/root/cimv2")
Set 对象 = WMI服务.InstancesOf("Win32_Processor")
Me.CurrentX = 0
Me.CurrentY = 0
For Each 子对象 In 对象
If 刷新 = 0 Then
刷新 = 1
Me.Cls
End If
Me.Print 子对象.Name "[" 子对象.CurrentClockSpeed "Hz] 使用率:" _
子对象.LoadPercentage "%"
Next
End Sub
VB.NET2008从网上找到两个函数,一个是获得CPUID,另一个是获得MAC地址,提示若干位定义的类型。
缺少system.management.dll引用
在项目名右键--添加引用--找到system.management 确定,然后...就没然后了,就行了
VS2010中怎么获取cpu或者硬盘序列号。用vb.net。想编一个注册码的软件
Private Function 硬盘序列号() As String
Try
Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 1\Target Id 0\Logical Unit Id 0")
硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))
Catch
Try
Dim myInfo As Microsoft.Win32.RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey("HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 1\Target Id 0\Logical Unit Id 0")
硬盘序列号 = Trim(myInfo.GetValue("SerialNumber"))
Catch
硬盘序列号 = ""
End Try
End Try
End Function
只在我的电脑上试过,你试下
分享题目:vb.netcpuid的简单介绍
网页链接:http://pwwzsj.com/article/hhjici.html