Ejemplo en vb.net enviado por Sebastián Perdomo, para obtener mediane WMI la temperatura del disco
Nota: se debe añadir la referencia a System.Management desde el menú referenciasCódigo fuente con un control button en el formulario
Option Explicit On
Imports System
Imports System.Management
Imports System.Windows.Forms
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "Averiguar la temperatura"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Cursor = Cursors.WaitCursor
Try
Dim Buscar As New ManagementObjectSearcher("root\WMI", _
"SELECT * FROM MSStorageDriver_ATAPISmartData")
For Each queryObj As ManagementObject In Buscar.Get()
Dim arrVendorSpecific As Byte() = queryObj("VendorSpecific")
MsgBox("La Temperatura es: " & arrVendorSpecific(115).ToString & " Grados")
Next
Catch err As ManagementException
MessageBox.Show("Error " & err.Message)
End Try
Me.Cursor = Cursors.Default
End Sub
End Class
No hay comentarios:
Publicar un comentario