Роман-вб писал(а):Sebas
Дело в том, что по данной теме я не имею ни малейшего представления. .
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Const LVM_FIRST As Integer = &H1000S
Private Const LVM_SETCOLUMNWIDTH As Integer = (LVM_FIRST + 30)
Private Const LVSCW_AUTOSIZE As Integer = -1
Private Const LVSCW_AUTOSIZE_USEHEADER As Integer = -2
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As String) As Integer
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
With ListView1
.Items.Clear()
.Columns.Clear()
.Columns.Add("DevID")
.Columns.Add("Avail")
.Columns.Add("AddrWd")
.Columns.Add("Status")
.Columns.Add("SpdNow")
.Columns.Add("SpdMax")
.Columns.Add("L2Siz")
.Columns.Add("L2Spd")
.Columns.Add("VoltCap")
.Columns.Add("Name")
.View = System.Windows.Forms.View.Details
End With
Command1.Text = "Get Adapter Info"
End Sub
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
ListView1.Items.Clear()
Call wmiProcessorInfo()
Call lvAutosizeControl(ListView1)
End Sub
Private Sub lvAutosizeControl(ByRef lv As System.Windows.Forms.ListView)
Dim col2adjust As Integer
'/* Size each column based on the maximum of
'/* EITHER the columnheader text width, or,
'/* if the items below it are wider, the
'/* widest list item in the column
For col2adjust = 0 To lv.Columns.Count - 1
Call SendMessage(lv.Handle.ToInt32, LVM_SETCOLUMNWIDTH, col2adjust, LVSCW_AUTOSIZE_USEHEADER)
Next
End Sub
Private Sub wmiProcessorInfo()
Dim cpuSet As WbemScripting.SWbemObjectSet
Dim cpu As WbemScripting.SWbemObject
Dim itmx As System.Windows.Forms.ListViewItem
cpuSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_Processor")
On Error Resume Next
For Each cpu In cpuSet
itmx = ListView1.Items.Add(cpu.DeviceID)
If itmx.SubItems.Count > 1 Then
itmx.SubItems(1).Text = cpu.Availability
Else
itmx.SubItems.Insert(1, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.Availability))
End If
If itmx.SubItems.Count > 2 Then
itmx.SubItems(2).Text = cpu.AddressWidth
Else
itmx.SubItems.Insert(2, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.AddressWidth))
End If
If itmx.SubItems.Count > 3 Then
itmx.SubItems(3).Text = cpu.CpuStatus
Else
itmx.SubItems.Insert(3, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.CpuStatus))
End If
If itmx.SubItems.Count > 4 Then
itmx.SubItems(4).Text = cpu.CurrentClockSpeed
Else
itmx.SubItems.Insert(4, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.CurrentClockSpeed))
End If
If itmx.SubItems.Count > 5 Then
itmx.SubItems(5).Text = cpu.MaxClockSpeed
Else
itmx.SubItems.Insert(5, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.MaxClockSpeed))
End If
If itmx.SubItems.Count > 6 Then
itmx.SubItems(6).Text = cpu.L2CacheSize
Else
itmx.SubItems.Insert(6, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.L2CacheSize))
End If
If itmx.SubItems.Count > 7 Then
itmx.SubItems(7).Text = cpu.L2CacheSpeed
Else
itmx.SubItems.Insert(7, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.L2CacheSpeed))
End If
If itmx.SubItems.Count > 8 Then
itmx.SubItems(8).Text = cpu.VoltageCaps
Else
itmx.SubItems.Insert(8, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.VoltageCaps))
End If
If itmx.SubItems.Count > 9 Then
itmx.SubItems(9).Text = cpu.Name
Else
itmx.SubItems.Insert(9, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, cpu.Name))
End If
Next cpu
End Sub
End Class
If Num = 0 Then
WScript.Echo "No temperature probe data"
End If
Роман-вб писал(а):Sebas
С юмором у меня всё в порядке.
P.S. Sebas, а ты наверное на досуге с маленькими девочками развлекаешься
PUNK-GRUNGER писал(а):Все таки маленькие девочки лучше, чем маленькие мальчики
Роман-вб, ты извини если чо. Не удержался
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 107