内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

vb.net獲取cpu VBNET教程

vb.netfor循環(huán)占用cpu問(wèn)題

重新啟動(dòng)。vbnetfor循環(huán)占用cpu問(wèn)題只要重新啟動(dòng)就可以了。VBNET是一種簡(jiǎn)單,現(xiàn)代,面向?qū)ο蟮挠?jì)算機(jī)編程語(yǔ)言,它由微軟開(kāi)發(fā),將NETFramework和公共語(yǔ)言運(yùn)行庫(kù)的強(qiáng)大功能相結(jié)合。

成都創(chuàng)新互聯(lián)主營(yíng)貴定網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,app開(kāi)發(fā)定制,貴定h5成都小程序開(kāi)發(fā)搭建,貴定網(wǎng)站營(yíng)銷推廣歡迎貴定等地區(qū)企業(yè)咨詢

vb.net如何獲取當(dāng)前進(jìn)程的cpu和內(nèi)存使用率?

使用wmi

類“Win32_Processor”中LoadPercentage屬性為當(dāng)前的cpu使用率

示例代碼: Private Sub Timer1_Timer()

Dim WMI服務(wù) As Object

Dim 對(duì)象 As Object

Dim 子對(duì)象 As Object

Dim 電腦名 As String

Dim 刷新 As Long

刷新 = 0

電腦名 = "." '表示本地計(jì)算機(jī)

Set WMI服務(wù) = GetObject("winmgmts://" 電腦名 "/root/cimv2")

Set 對(duì)象 = WMI服務(wù).InstancesOf("Win32_Processor")

Me.CurrentX = 0

Me.CurrentY = 0

For Each 子對(duì)象 In 對(duì)象

If 刷新 = 0 Then

刷新 = 1

Me.Cls

End If

Me.Print 子對(duì)象.Name "[" 子對(duì)象.CurrentClockSpeed "Hz] 使用率:" _

子對(duì)象.LoadPercentage "%"

Next

End Sub

vb.net 如何獲取當(dāng)前系統(tǒng)的CPU使用率

使用wmi

類“Win32_Processor”中LoadPercentage屬性為當(dāng)前的cpu使用率

示例代碼: Private Sub Timer1_Timer()

Dim WMI服務(wù) As Object

Dim 對(duì)象 As Object

Dim 子對(duì)象 As Object

Dim 電腦名 As String

Dim 刷新 As Long

刷新 = 0

電腦名 = "." '表示本地計(jì)算機(jī)

Set WMI服務(wù) = GetObject("winmgmts://" 電腦名 "/root/cimv2")

Set 對(duì)象 = WMI服務(wù).InstancesOf("Win32_Processor")

Me.CurrentX = 0

Me.CurrentY = 0

For Each 子對(duì)象 In 對(duì)象

If 刷新 = 0 Then

刷新 = 1

Me.Cls

End If

Me.Print 子對(duì)象.Name "[" 子對(duì)象.CurrentClockSpeed "Hz] 使用率:" _

子對(duì)象.LoadPercentage "%"

Next

End Sub

VB.Net (VB2010)怎么使用WMI來(lái)獲取CPU型號(hào)?

Imports?System

Imports?System.Management

Module?Module1

Sub?Main()

Dim?scope?As?New?ManagementScope("\\.\root\cimv2")

scope.Connect()

Dim?objectQuery?As?New?ObjectQuery("SELECT?*?FROM?Win32_Processor")

Dim?searcher?As?New?ManagementObjectSearcher(scope,?objectQuery)

Dim?cpu?As?ManagementObject

For?Each?cpu?In?searcher.Get()

Console.WriteLine("Processor:?"??cpu("Name"))

Console.WriteLine("Manufacturer:?"??cpu("Manufacturer"))

Console.WriteLine("Clock?frequency:?"??cpu("MaxClockSpeed")??"?MHz")

Console.WriteLine("NumberOfLogicalProcessors:?"??cpu("NumberOfLogicalProcessors"))

Console.WriteLine("NumberOfCores:?"??cpu("NumberOfCores"))

Console.WriteLine()

Next?cpu

Console.WriteLine()

Console.WriteLine("Press?any?key?to?quit")

Console.ReadKey()

End?Sub

End?Module

VB.NET,部分機(jī)器獲取不了CPU號(hào)(高分急用)

VB?我不熟,下面是用匯編寫(xiě)的,我運(yùn)行過(guò)可以的。

//--------------------------------

.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

//-------------------------------------------------------

程序確實(shí)可以執(zhí)行,輸出CPU的ID等信息。

注意:DOS下或MS-DOS下使用。

VB.NET怎么編程測(cè)試CPU電壓

'

'?。?!重要:首先要添加“引用”一個(gè)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編號(hào)

Dim?[MyClass]?As?New?ManagementClass("Win32_Processor")

Dim?MyCollection?As?ManagementObjectCollection?=?[MyClass].GetInstances()

Dim?MyInfo?As?String?=?"當(dāng)前系統(tǒng)CPU編號(hào)是:"

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)

'獲取計(jì)算機(jī)CPU的當(dāng)前電壓

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的當(dāng)前電壓是:"

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)

'獲取計(jì)算機(jī)CPU的外部頻率

Dim?MyInfo?As?String?=?"計(jì)算機(jī)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)

'獲取計(jì)算機(jī)CPU的二級(jí)緩存

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的二級(jí)緩存尺寸是:"

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)

'獲取計(jì)算機(jī)CPU的制造商名稱

Dim?MyInfo?As?String?=?"計(jì)算機(jī)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)

'獲取計(jì)算機(jī)CPU的產(chǎn)品名稱

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的產(chǎn)品名稱是:"

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)

'獲取計(jì)算機(jī)CPU的版本信息

Dim?MyInfo?As?String?=?"計(jì)算機(jī)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)

'獲取計(jì)算機(jī)CPU的當(dāng)前使用百分比?注意要把SQLserver或者其他耗CPU的軟件開(kāi)著否則看不到效果就一直為0

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的當(dāng)前使用百分比是:"

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)

'獲取計(jì)算機(jī)CPU的最大時(shí)鐘頻率

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的最大時(shí)鐘頻率是:"

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)

'獲取計(jì)算機(jī)CPU的當(dāng)前時(shí)鐘頻率

Dim?MyInfo?As?String?=?"計(jì)算機(jī)CPU的當(dāng)前時(shí)鐘頻率是:"

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)

'獲取計(jì)算機(jī)的CPU地址寬度

Dim?MyInfo?As?String?=?"當(dāng)前計(jì)算機(jī)的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)

'獲取計(jì)算機(jī)的CPU數(shù)據(jù)寬度

Dim?MyInfo?As?String?=?"當(dāng)前計(jì)算機(jī)的CPU數(shù)據(jù)寬度是:"

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

新聞標(biāo)題:vb.net獲取cpu VBNET教程
瀏覽路徑:http://m.rwnh.cn/article38/hiehsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、網(wǎng)站導(dǎo)航面包屑導(dǎo)航、全網(wǎng)營(yíng)銷推廣網(wǎng)站收錄、虛擬主機(jī)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站
曲麻莱县| 金山区| 清流县| 山东| 油尖旺区| 临高县| 峨眉山市| 宁明县| 兴隆县| 建宁县| 施秉县| 南江县| 济宁市| 宽城| 禹州市| 万全县| 贵港市| 武城县| 晋江市| 株洲市| 兴文县| 朝阳市| 屏南县| 临泉县| 上林县| 茂名市| 乌拉特后旗| 从江县| 泽州县| 乌拉特前旗| 平山县| 高淳县| 泸西县| 栾川县| 郴州市| 沁水县| 无为县| 乌拉特中旗| 曲水县| 如东县| 彭泽县|