chaiti_c
asked on
Code for getting the Hardware Configuration of a PC using Visual Basic 6
I am writing a program that will display the hardware caonfiguration of the machine on which it is executed. I am unable to get the details regarding the Processor, MotherBoard, Chip Set, monitor(Manufacturer) and the RAM Type.
Can you please give me the code that will give me the the above mentioned information regarding the Processor, MotherBoard, Chip Set, monitor and the RAM Type.
With regards
Chaiti
Can you please give me the code that will give me the the above mentioned information regarding the Processor, MotherBoard, Chip Set, monitor and the RAM Type.
With regards
Chaiti
ASKER
I have the following code-
For OS I am using -
RegRead(HKEY_LOCAL_MACHINE , "SOFTWARE\Microsoft\Window s NT\CurrentVersion", "RegisteredOwner", "")
For the CPU I am getting -
RegRead(HKEY_LOCAL_MACHINE , "Hardware\Description\Syst em\Central Processor\ 0", "VendorIdentifier", "")
What should I use for the Motherbord, chipset, processor type and the monitor manufacturer
Can you please help?
With regards
Chaitali
For OS I am using -
RegRead(HKEY_LOCAL_MACHINE
For the CPU I am getting -
RegRead(HKEY_LOCAL_MACHINE
What should I use for the Motherbord, chipset, processor type and the monitor manufacturer
Can you please help?
With regards
Chaitali
For yor motherbord:
Try this
From http://www.mvps.org/vbnet/index.html?code/wmi/wmiprocessor.htm
Option Explicit
Private Sub Command1_Click()
Call wmiBaseBoardInfo
End Sub
Private Sub wmiBaseBoardInfo()
Dim BaseBoardSet
Dim bb
Set BaseBoardSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_BaseBoa rd")
On Local Error Resume Next
For Each bb In BaseBoardSet
Debug.Print bb.Product
Debug.Print bb.Manufacturer
'string Caption
'string ConfigOptions[]
'string CreationClassName
'real32 Depth
'string Description
'real32 Height
'boolean HostingBoard
'boolean HotSwappable
'DateTime InstallDate
'string Manufacturer
'string Model
'string Name
'string OtherIdentifyingInfo
'string PartNumber
'boolean PoweredOn
'string Product
'boolean Removable
'boolean Replaceable
'string RequirementsDescription
'boolean RequiresDaughterBoard
'string SerialNumber
'string SKU
'string SlotLayout
'boolean SpecialRequirements
'string Status
'string Tag
'string Version
'real32 Weight
'real32 Width
Next
End Sub
Try this
From http://www.mvps.org/vbnet/index.html?code/wmi/wmiprocessor.htm
Option Explicit
Private Sub Command1_Click()
Call wmiBaseBoardInfo
End Sub
Private Sub wmiBaseBoardInfo()
Dim BaseBoardSet
Dim bb
Set BaseBoardSet = GetObject("winmgmts:{imper
InstancesOf("Win32_BaseBoa
On Local Error Resume Next
For Each bb In BaseBoardSet
Debug.Print bb.Product
Debug.Print bb.Manufacturer
'string Caption
'string ConfigOptions[]
'string CreationClassName
'real32 Depth
'string Description
'real32 Height
'boolean HostingBoard
'boolean HotSwappable
'DateTime InstallDate
'string Manufacturer
'string Model
'string Name
'string OtherIdentifyingInfo
'string PartNumber
'boolean PoweredOn
'string Product
'boolean Removable
'boolean Replaceable
'string RequirementsDescription
'boolean RequiresDaughterBoard
'string SerialNumber
'string SKU
'string SlotLayout
'boolean SpecialRequirements
'string Status
'string Tag
'string Version
'real32 Weight
'real32 Width
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks I am going through the code and will get back as soon as possible
With regards
Chaitali
With regards
Chaitali
ASKER
Thank you its working when I am keying in the computer name. I would be running this on a standalone machine and the system requires to detect the computer name from the system
How do I do that ?
How do I do that ?
ASKER
Can you please help with the passing of the computer name on which this system will be executed?
Unless my code detects the computer name and starts executing the rest of code I am in a fix
Regards
Chaitali
Unless my code detects the computer name and starts executing the rest of code I am in a fix
Regards
Chaitali
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function Get_ComputerName()
Dim lpBuff As String * 25
Dim ret As Long, ComputerName As String
ret = GetComputerName(lpBuff, 25)
ComputerName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
Get_ComputerName = ComputerName
End Function
Private Sub Form_Load()
MsgBox Get_ComputerName
End Sub
Function Get_ComputerName()
Dim lpBuff As String * 25
Dim ret As Long, ComputerName As String
ret = GetComputerName(lpBuff, 25)
ComputerName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
Get_ComputerName = ComputerName
End Function
Private Sub Form_Load()
MsgBox Get_ComputerName
End Sub
ASKER
I have used -
Set BaseBoardSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_BaseBoa rd")
in my code to get the hardware details and the exe is running fine on Windows2000 and XP. But when I am running this exe on a Windows 98 machine I am getting the following error -
File name or class name not found during Automation operation 432 Project1 error
When I am loading this application in Win98 there is a sharing violation for the file msvcrt.dll but i have managed to copy the file by booting in DOS.
Please can you suggest how can I get this code to work in Windows98 as its working in Win2000 and XP-
The code follows-
On Error GoTo errorhandler
listctr = 0
strComputer = sComputerName
'Module1.spr2.sdt = "Hardware Details"
'Open "c:\texp" For Output As #1
'Write #1, Module1.spr2.sdt
'formhead = "Hardware Configuration of " & sComputerName
'Base Board Information'
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("S elect * from Win32_BaseBoard")
strconf = Space(2) & "1. MotherBoard Configuration Option: "
List1.AddItem strconf
strconf = Space(5) & String(53, "-")
List1.AddItem strconf
strconf = ""
For Each objItem In colItems
For Each strOption In objItem.ConfigOptions
conf = strOption
strconf = strconf & conf
Next
mother_flag = "0"
If Len(strconf) = 0 Then
mother_flag = "1"
Else
List1.AddItem Space(5) & strconf
List1.AddItem " "
End If
List1.AddItem Space(5) & "Name: " & objItem.Name & " Product: " & objItem.Product
'Module1.spr2.sdt = "Name: " & objItem.Name & " Product: " & objItem.Product
'Write #1, Module1.spr2.sdt
'List1.AddItem "Depth: " & objItem.Depth
List1.AddItem Space(5) & "Description: " & objItem.Description
'Module1.spr2.sdt = "Description: " & objItem.Description
'Write #1, Module1.spr2.sdt
'List1.AddItem "Height: " & objItem.Height
'List1.AddItem "Hosting Board: " & objItem.HostingBoard & " Hot Swappable: " & objItem.HotSwappable & " Replaceable: " & objItem.Replaceable
'Module1.spr2.sdt = "Hosting Board: " & objItem.HostingBoard & " Hot Swappable: " & objItem.HotSwappable & " Replaceable: " & objItem.Replaceable
'Write #1, Module1.spr2.sdt
If mother_flag = "1" Then
List1.AddItem Space(5) & "Manufacturer: " & "Non-Intel" '& " Model: " & objItem.Model
Else
List1.AddItem Space(5) & "Manufacturer: " & objItem.Manufacturer '& " Model: " & objItem.Model
End If
mother_flag = "0"
'Module1.spr2.sdt = "Manufacturer: " & objItem.Manufacturer & " Model: " & objItem.Model
'Write #1, Module1.spr2.sdt
'List1.AddItem "Other Identifying Information: " & objItem.OtherIdentifyingIn fo & " Part Number: " & objItem.PartNumber
'Module1.spr2.sdt = "Other Identifying Information: " & objItem.OtherIdentifyingIn fo & " Part Number: " & objItem.PartNumber
'Write #1, Module1.spr2.sdt
'List1.AddItem "Powered-On: " & objItem.PoweredOn
'List1.AddItem "Removable: " & objItem.Removable
'List1.AddItem "Requirements Description: " & objItem.RequirementsDescri ption
'Module1.spr2.sdt = "Requirements Description: " & objItem.RequirementsDescri ption
'Write #1, Module1.spr2.sdt
'List1.AddItem "Requires Daughterboard: " & objItem.RequiresDaughterBo ard
'Module1.spr2.sdt = "Requires Daughterboard: " & objItem.RequiresDaughterBo ard
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Serial Number: " & objItem.SerialNumber & " Version: " & objItem.Version
'Module1.spr2.sdt = "Serial Number: " & objItem.SerialNumber
'Write #1, Module1.spr2.sdt
'List1.AddItem "SKU: " & objItem.SKU & " Slot Layout: " & objItem.SlotLayout & " Special Requirements: " & objItem.SpecialRequirement s
'Module1.spr2.sdt = "SKU: " & objItem.SKU & " Slot Layout: " & objItem.SlotLayout & " Special Requirements: " & objItem.SpecialRequirement s & " Version: " & objItem.Version
'Write #1, Module1.spr2.sdt
'List1.AddItem "Tag: " & objItem.Tag
'List1.AddItem "Weight: " & objItem.Weight
'List1.AddItem "Width: " & objItem.Width
Next
'Mother Board Information'
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("S elect * from Win32_MotherboardDevice")
For Each objItem In colItems
List1.AddItem Space(5) & "Description: " & objItem.Description & " Device ID: " & objItem.DeviceID & " Primary Bus Type: " & objItem.PrimaryBusType & " Secondary Bus Type: " & objItem.SecondaryBusType
'Module1.spr2.sdt = "Description: " & objItem.Description & "Device ID: " & objItem.DeviceID
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Primary Bus Type: " & objItem.PrimaryBusType
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Secondary Bus Type: " & objItem.SecondaryBusType
'Write #1, Module1.spr2.sdt
Next
'Write #1, " "
'Computer Architecture
List1.AddItem " "
'Module1.spr2.sdt = "Computer Architecture"
'Write #1, Module1.spr2.sdt
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colProcessors = objWMIService.ExecQuery _
("Select * From Win32_Processor")
For Each objProcessor In colProcessors
If objProcessor.Architecture = 0 Then
List1.AddItem Space(5) & "This is an x86 computer."
'Module1.spr2.sdt = "This is an x86 computer."
ElseIf objProcessor.Architecture = 1 Then
List1.AddItem Space(5) & "This is a MIPS computer."
'Module1.spr2.sdt = "This is a MIPS computer."
ElseIf objProcessor.Architecture = 2 Then
List1.AddItem Space(5) & "This is an Alpha computer."
'Module1.spr2.sdt = "This is an Alpha computer."
ElseIf objProcessor.Architecture = 3 Then
List1.AddItem Space(5) & "This is a PowerPC computer."
'Module1.spr2.sdt = "This is a PowerPC computer."
ElseIf objProcessor.Architecture = 6 Then
List1.AddItem Space(5) & "This is an ia64 computer."
'Module1.spr2.sdt = "This is an ia64 computer."
Else
List1.AddItem Space(5) & " The computer type could not be determined."
'Module1.spr2.sdt = "The computer type could not be determined."
End If
'Write #1, Module1.spr2.sdt
Next
'Processor Details
List1.AddItem " "
List1.AddItem Space(2) & "2. Processor"
List1.AddItem Space(2) & " -----------------"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("S elect * from Win32_Processor")
For Each objItem In colItems
List1.AddItem Space(5) & "Address Width: " & objItem.AddressWidth & " Architecture: " & objItem.Architecture & " Availability: " & objItem.Availability & " CPU Status: " & objItem.CpuStatus & " Current Clock Speed: " & objItem.CurrentClockSpeed & " Data Width: " & objItem.DataWidth & " Device ID: " & objItem.DeviceID
'Module1.spr2.sdt = "Address Width: " & objItem.AddressWidth
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Architecture: " & objItem.Architecture
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Availability: " & objItem.Availability
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "CPU Status: " & objItem.CpuStatus
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Current Clock Speed: " & objItem.CurrentClockSpeed
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Data Width: " & objItem.DataWidth
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Description: " & objItem.Description & "External Clock: " & objItem.ExtClock & "Family: " & objItem.Family & "L2 Cache Size: " & objItem.L2CacheSize
'Module1.spr2.sdt = "Description: " & objItem.Description
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Device ID: " & objItem.DeviceID
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "External Clock: " & objItem.ExtClock
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Family: " & objItem.Family
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "L2 Cache Size: " & objItem.L2CacheSize
'Write #1, Module1.spr2.sdt
'List1.AddItem "L2 Cache Speed: " & objItem.L2CacheSpeed
'List1.AddItem "Level: " & objItem.Level
'List1.AddItem "Load Percentage: " & objItem.LoadPercentage
List1.AddItem Space(5) & "Name: " & objItem.Name & " Manufacturer: " & objItem.Manufacturer & " Maximum Clock Speed: " & objItem.MaxClockSpeed & " Processor ID: " & objItem.ProcessorId
'Module1.spr2.sdt = "Manufacturer: " & objItem.Manufacturer
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Maximum Clock Speed: " & objItem.MaxClockSpeed
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Name: " & objItem.Name
'Write #1, Module1.spr2.sdt
'List1.AddItem "PNP Device ID: " & objItem.PNPDeviceID
'Module1.spr2.sdt = "Processor ID: " & objItem.ProcessorId
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Processor Type: " & objItem.ProcessorType & " Socket Designation: " & objItem.SocketDesignation & " Status Information: " & objItem.StatusInfo & " Stepping: " & objItem.Stepping & " Upgrade Method: " & objItem.UpgradeMethod
'Module1.spr2.sdt = "Processor Type: " & objItem.ProcessorType
'Write #1, Module1.spr2.sdt
'List1.AddItem "Revision: " & objItem.Revision
'List1.AddItem "Role: " & objItem.Role
'Module1.spr2.sdt = "Socket Designation: " & objItem.SocketDesignation
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Status Information: " & objItem.StatusInfo
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Stepping: " & objItem.Stepping
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Unique Id: " & objItem.UniqueId & " Version: " & objItem.Version
'Module1.spr2.sdt = "Unique Id: " & objItem.UniqueId
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Upgrade Method: " & objItem.UpgradeMethod
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Version: " & objItem.Version
'Write #1, Module1.spr2.sdt
'List1.AddItem "Voltage Caps: " & objItem.VoltageCaps
Next
'On Board Devices
'Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
'Set colItems = objWMIService.ExecQuery("S elect * from Win32_OnBoardDevice")
'List1.AddItem " "
'For Each objItem In colItems
'List1.AddItem "Description: " & objItem.Description
'List1.AddItem "Device Type: " & objItem.DeviceType
'List1.AddItem "Model: " & objItem.Model
'List1.AddItem "Name: " & objItem.Name
'List1.AddItem "Tag: " & objItem.Tag
'List1.AddItem "Version: " & objItem.Version
'Next
'Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
'Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
'For Each objSMBIOS In colSMBIOS
'List1.AddItem "Part Number: " & objSMBIOS.PartNumber
'List1.AddItem "Serial Number: " & objSMBIOS.SerialNumber
'List1.AddItem "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
'Next
'Accessing the Volatile Memory
Dim MS As MEMORYSTATUS
MS.dwLength = Len(MS)
GlobalMemoryStatus MS
List1.AddItem " "
'divide the memory variables by 1024 (nkb)
'to obtain the size in kilobytes
'List1.AddItem Format$(MS.dwMemoryLoad, "###,###,###,###") & " % used"
List1.AddItem Space(2) & "3. RAM: "
List1.AddItem Space(2) & " ---------"
'List1.AddItem " "
List1.AddItem Space(5) & "Memory: " & Format$(MS.dwTotalPhys / 1024, "###,###,###,###") & " Kbyte"
'Module1.spr2.sdt = "RAM" & Format$(MS.dwTotalPhys / 1024, "###,###,###,###") & " Kbyte"
'Write #1, Module1.spr2.sdt
'List1.AddItem Format$(MS.dwAvailPhys / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwTotalPageFile / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwAvailPageFile / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwTotalVirtual / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwAvailVirtual / 1024, "###,###,###,###") & " Kbyte"
List1.AddItem " "
'ctr = 1
'Physical Disk Drive
Set DiskDriveSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_DiskDri ve")
List1.AddItem Space(2) & "4. Details of Disk " '& ctr
List1.AddItem Space(2) & " -------------------------- ---------- --"
'Module1.spr2.sdt = "Physical Details of Disk No. " & ctr
'Write #1, Module1.spr2.sdt
List1.AddItem ""
List1.AddItem Space(2) & " Physical Details- "
For Each dd In DiskDriveSet
List1.AddItem Space(5) & "Description : " & dd.Description & " Index= " & dd.Index & " DeviceID : " & dd.DeviceID & " Caption :" & dd.Caption
'Module1.spr2.sdt = "Description=" & dd.Description & " Index= " & dd.Index & " DeviceID= " & dd.DeviceID
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Manufacturer : " & dd.Manufacturer & " Model : " & dd.Model & " Interface : " & dd.InterfaceType & " Media :" & dd.MediaLoaded & " " & dd.MediaType
'Module1.spr2.sdt = dd.Caption & " " & dd.Manufacturer & " " & dd.Model & " " & dd.InterfaceType & " " & dd.MediaLoaded & " " & dd.MediaType
'Write #1, Module1.spr2.sdt
'add physical info
List1.AddItem Space(5) & "Status=" & dd.Status & " Size:" & FormatNumber(dd.Size, 0) & " Partition:" & dd.Partitions
'Module1.spr2.sdt = "Status=" & dd.Status & " HDD:" & FormatNumber(dd.Size, 0) & " Partition=" & dd.Partitions
'Write #1, Module1.spr2.sdt
'List1.AddItem FormatNumber(dd.BytesPerSe ctor, 0)
'List1.AddItem FormatNumber(dd.SectorsPer Track, 0)
'List1.AddItem FormatNumber(dd.TotalCylin ders, 0)
'note: the value for the TotalHeads property
'is obtained through extended functions of
'BIOS interrupt 13h. The value may be inaccurate
'if the drive uses a translation scheme to
'support high capacity disk sizes. Consult
'the manufacturer for accurate drive
'specifications
'List1.AddItem FormatNumber(dd.TotalHeads , 0)
'List1.AddItem FormatNumber(dd.TotalTrack s, 0)
'List1.AddItem FormatNumber(dd.TracksPerC ylinder, 0)
ctr = ctr + 1
Next
'LogicalDrives
List1.AddItem ""
List1.AddItem Space(2) & " Logical Details- "
Call wmiLogicalDiskInfo
Call lvAutosizeControl(List1)
List1.AddItem " "
List1.AddItem Space(2) & "5. Keyboard "
List1.AddItem Space(2) & " ---------------"
Set wmiObjSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_Keyboar d")
For Each obj In wmiObjSet
List1.AddItem Space(5) & "Name: " & obj.Name & " Caption: " & obj.Caption & " Status: " & obj.Status
List1.AddItem Space(5) & "Description: " & obj.Description & IIf(obj.Availability, obj.Availability, "null") & "Layout: " & obj.Layout
List1.AddItem Space(5) & "No.of Function Keys: " & obj.NumberOfFunctionKeys & " DeviceID: " & obj.DeviceID & " PNP: " & obj.PNPDeviceID
Next
List1.AddItem " "
List1.AddItem Space(2) & "6. Network "
List1.AddItem Space(2) & " --------------"
Set NetAdapter = GetObject("winmgmts:").Ins tancesOf(" Win32_Netw orkAdapter ")
For Each na In NetAdapter
'Set itmx = na.DeviceID
'List1.AddItem "Device ID: " & na.DeviceID
List1.AddItem Space(5) & na.MACAddress & " " & na.AdapterType & " " & na.Manufacturer & " " & na.Description
Next
List1.AddItem " "
List1.AddItem Space(2) & "7. Monitor "
List1.AddItem Space(2) & " ------------"
Set dtmSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_Desktop Monitor")
For Each dtm In dtmSet
'Set itmx = ListView1.ListItems.Add(, , dtm.DeviceID)
Select Case dtm.Availability
Case 1: msg = "other"
Case 2: msg = "unknown "
Case 3: msg = "running/full power"
Case 4: msg = "warning "
Case 5: msg = "in test "
Case 6: msg = "not applicable "
Case 7: msg = "power off "
Case 8: msg = "off line "
Case 9: msg = "off duty "
Case 10: msg = "degraded "
Case 11: msg = "not installed "
Case 12: msg = "install error "
Case 13: msg = "power save - unknown "
Case 14: msg = "power save - low power mode "
Case 15: msg = "power save - standby "
Case 16: msg = "power cycle "
Case 17: msg = "power save - warning "
Case 18: msg = "paused "
Case 19: msg = "not ready "
Case 20: msg = "not configured "
Case 21: msg = "quiesced"
End Select
List1.AddItem Space(5) & dtm.Caption & " " & dtm.MonitorManufacturer & " " & msg
Next
Set dcSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_Display Configurat ion")
For Each dc In dcSet
'Set itmx = ListView1.ListItems.Add(, , dc.Caption)
List1.AddItem Space(5) & "Version=" & dc.DriverVersion & " Pixel =" & dc.LogPixels & " PelsHeight" & dc.PelsHeight & " Spec=" & dc.SpecificationVersion
Next
List1.AddItem " "
List1.AddItem " "
List1.AddItem Space(2) & "8. Printer Details "
List1.AddItem Space(2) & " ---------------------"
'printer
ReDim TabArray(0 To 1) As Long
TabArray(0) = 120
TabArray(1) = 191
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 2&, TabArray(0))
'List1.Refresh
Dim numPrinters As Long
numPrinters = EnumPrintersWinNT(List1)
List1.AddItem " "
List1.AddItem " "
List1.AddItem Space(2) & "9. Port Details "
List1.AddItem Space(2) & " -------------------"
'PORT
Dim numPorts As Long
ReDim TabArray(0 To 2) As Long
TabArray(0) = 65
TabArray(1) = 129
TabArray(2) = 188
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 3&, TabArray(0))
'List1.Refresh
numPorts = GetAvailablePorts(List1)
'BIOS Information
List1.AddItem " "
List1.AddItem Space(1) & "10. BIOS Details "
List1.AddItem Space(2) & " --------------------"
Set BiosSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_BIOS")
For Each bios In BiosSet
'Set itmx = ListView1.ListItems.Add(, , "PrimaryBIOS")
List1.AddItem Space(5) & "PrimaryBIOS: " & bios.PrimaryBIOS & " Status: " & bios.Status & " Caption: " & bios.Caption & " Description: " & bios.Description
List1.AddItem Space(5) & "Name: " & bios.Name & " Manufacturer: " & bios.Manufacturer & " ReleaseDate" & bios.ReleaseDate & " SerialNo.: " & bios.SerialNumber
'Set itmx = ListView1.ListItems.Add(, , "Status")
'For cnt = LBound(bios.BIOSVersion) To UBound(bios.BIOSVersion)
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "BIOSVersion strings", ""))
'List1.AddItem bios.BIOSVersion(cnt)
'Next
'Set itmx = ListView1.ListItems.Add(, , "Caption")
'Set itmx = ListView1.ListItems.Add(, , "Description")
'Set itmx = ListView1.ListItems.Add(, , "Name")
'Set itmx = ListView1.ListItems.Add(, , "Manufacturer")
'Set itmx = ListView1.ListItems.Add(, , "ReleaseDate")
'Set itmx = ListView1.ListItems.Add(, , "SerialNumber")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSBIOSVersion")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSMajorVersion")
'List1.AddItem Space(2) & " Version: " & " Major: " & bios.SMBIOSBIOSVersion & bios.SMBIOSMajorVersion & " Minor: " & bios.SMBIOSMinorVersion & " Present: " & bios.SMBIOSPresent
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSMinorVersion")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSPresent")
'Set itmx = ListView1.ListItems.Add(, , "SoftwareElementID")
'itmx.SubItems(1) = bios.SoftwareElementID
'Set itmx = ListView1.ListItems.Add(, , "SoftwareElementState")
Select Case bios.SoftwareElementState
Case 0: msg = "deployable"
Case 1: msg = "installable"
Case 2: msg = "executable"
Case 3: msg = "running"
End Select
List1.AddItem Space(5) & msg & " Version: " & bios.Version
'Set itmx = ListView1.ListItems.Add(, , "Version")
'Set itmx = ListView1.ListItems.Add(, , "InstallableLanguages")
'itmx.SubItems(1) = bios.InstallableLanguages
'Set itmx = ListView1.ListItems.Add(, , "CurrentLanguage")
'itmx.SubItems(1) = bios.CurrentLanguage
'For cnt = LBound(bios.ListOfLanguage s) To UBound(bios.ListOfLanguage s)
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "ListOfLanguages", ""))
'itmx.SubItems(1) = bios.ListOfLanguages(cnt)
'Next cnt
tot_msg = ""
For cnt = LBound(bios.BiosCharacteri stics) To UBound(bios.BiosCharacteri stics)
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "BIOS Characteristics", ""))
Select Case bios.BiosCharacteristics(c nt)
Case 0: msg = "reserved"
Case 1: msg = "reserved"
Case 2: msg = "unknown"
Case 3: msg = "BIOS characteristics not supported"
Case 4: msg = "ISA supported"
Case 5: msg = "MCA supported"
Case 6: msg = "EISA supported"
Case 7: msg = "PCI supported"
Case 8: msg = "PC Card (PCMCIA) supported"
Case 9: msg = "Plug and Play supported"
Case 10: msg = "APM is supported"
Case 11: msg = "BIOS upgradable (Flash)"
Case 12: msg = "BIOS shadowing allowed"
Case 13: msg = "VL-VESA supported"
Case 14: msg = "ESCD support available"
Case 15: msg = "Boot from CD supported"
Case 16: msg = "Selectable boot supported"
Case 17: msg = "BIOS ROM socketed"
Case 18: msg = "Boot from PC card (PCMCIA) supported"
Case 19: msg = "EDD (Enhanced Disk Drive) specification supported"
Case 20: msg = "Int 13h, Japanese Floppy for NEC 9800 1.2mb (3.5, 1k b/s, 360 RPM) supported"
Case 21: msg = "Int 13h, Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) supported"
Case 22: msg = "Int 13h, 5.25 / 360 KB floppy services supported"
Case 23: msg = "Int 13h, 5.25 /1.2MB floppy services supported"
Case 24: msg = "Int 13h 3.5 / 720 KB floppy services supported"
Case 25: msg = "Int 13h, 3.5 / 2.88 MB floppy services supported"
Case 26: msg = "Int 5h, print screen service supported"
Case 27: msg = "Int 9h, 8042 keyboard services supported"
Case 28: msg = "Int 14h, serial services supported"
Case 29: msg = "Int 17h, printer services supported"
Case 30: msg = "Int 10h, CGA/Mono video aervices supported"
Case 31: msg = "NEC PC-98"
Case 32: msg = "ACPI supported"
Case 33: msg = "USB Legacy supported"
Case 34: msg = "AGP supported"
Case 35: msg = "I2O boot supported"
Case 36: msg = "LS-120 boot supported"
Case 37: msg = "ATAPI ZIP drive boot supported"
Case 38: msg = "1394 boot supported"
Case 39: msg = "Smart battery supported"
End Select
If Len(tot_msg) > 60 Then
List1.AddItem Space(5) & tot_msg
tot_msg = ""
Else
tot_msg = tot_msg & msg & " "
End If
Next 'For cnt
List1.AddItem Space(5) & tot_msg
Next 'For Each bios
'Slots
List1.AddItem Space(5)
'Close 1
Set BaseBoardSet = GetObject("winmgmts:{imper
InstancesOf("Win32_BaseBoa
in my code to get the hardware details and the exe is running fine on Windows2000 and XP. But when I am running this exe on a Windows 98 machine I am getting the following error -
File name or class name not found during Automation operation 432 Project1 error
When I am loading this application in Win98 there is a sharing violation for the file msvcrt.dll but i have managed to copy the file by booting in DOS.
Please can you suggest how can I get this code to work in Windows98 as its working in Win2000 and XP-
The code follows-
On Error GoTo errorhandler
listctr = 0
strComputer = sComputerName
'Module1.spr2.sdt = "Hardware Details"
'Open "c:\texp" For Output As #1
'Write #1, Module1.spr2.sdt
'formhead = "Hardware Configuration of " & sComputerName
'Base Board Information'
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colItems = objWMIService.ExecQuery("S
strconf = Space(2) & "1. MotherBoard Configuration Option: "
List1.AddItem strconf
strconf = Space(5) & String(53, "-")
List1.AddItem strconf
strconf = ""
For Each objItem In colItems
For Each strOption In objItem.ConfigOptions
conf = strOption
strconf = strconf & conf
Next
mother_flag = "0"
If Len(strconf) = 0 Then
mother_flag = "1"
Else
List1.AddItem Space(5) & strconf
List1.AddItem " "
End If
List1.AddItem Space(5) & "Name: " & objItem.Name & " Product: " & objItem.Product
'Module1.spr2.sdt = "Name: " & objItem.Name & " Product: " & objItem.Product
'Write #1, Module1.spr2.sdt
'List1.AddItem "Depth: " & objItem.Depth
List1.AddItem Space(5) & "Description: " & objItem.Description
'Module1.spr2.sdt = "Description: " & objItem.Description
'Write #1, Module1.spr2.sdt
'List1.AddItem "Height: " & objItem.Height
'List1.AddItem "Hosting Board: " & objItem.HostingBoard & " Hot Swappable: " & objItem.HotSwappable & " Replaceable: " & objItem.Replaceable
'Module1.spr2.sdt = "Hosting Board: " & objItem.HostingBoard & " Hot Swappable: " & objItem.HotSwappable & " Replaceable: " & objItem.Replaceable
'Write #1, Module1.spr2.sdt
If mother_flag = "1" Then
List1.AddItem Space(5) & "Manufacturer: " & "Non-Intel" '& " Model: " & objItem.Model
Else
List1.AddItem Space(5) & "Manufacturer: " & objItem.Manufacturer '& " Model: " & objItem.Model
End If
mother_flag = "0"
'Module1.spr2.sdt = "Manufacturer: " & objItem.Manufacturer & " Model: " & objItem.Model
'Write #1, Module1.spr2.sdt
'List1.AddItem "Other Identifying Information: " & objItem.OtherIdentifyingIn
'Module1.spr2.sdt = "Other Identifying Information: " & objItem.OtherIdentifyingIn
'Write #1, Module1.spr2.sdt
'List1.AddItem "Powered-On: " & objItem.PoweredOn
'List1.AddItem "Removable: " & objItem.Removable
'List1.AddItem "Requirements Description: " & objItem.RequirementsDescri
'Module1.spr2.sdt = "Requirements Description: " & objItem.RequirementsDescri
'Write #1, Module1.spr2.sdt
'List1.AddItem "Requires Daughterboard: " & objItem.RequiresDaughterBo
'Module1.spr2.sdt = "Requires Daughterboard: " & objItem.RequiresDaughterBo
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Serial Number: " & objItem.SerialNumber & " Version: " & objItem.Version
'Module1.spr2.sdt = "Serial Number: " & objItem.SerialNumber
'Write #1, Module1.spr2.sdt
'List1.AddItem "SKU: " & objItem.SKU & " Slot Layout: " & objItem.SlotLayout & " Special Requirements: " & objItem.SpecialRequirement
'Module1.spr2.sdt = "SKU: " & objItem.SKU & " Slot Layout: " & objItem.SlotLayout & " Special Requirements: " & objItem.SpecialRequirement
'Write #1, Module1.spr2.sdt
'List1.AddItem "Tag: " & objItem.Tag
'List1.AddItem "Weight: " & objItem.Weight
'List1.AddItem "Width: " & objItem.Width
Next
'Mother Board Information'
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colItems = objWMIService.ExecQuery("S
For Each objItem In colItems
List1.AddItem Space(5) & "Description: " & objItem.Description & " Device ID: " & objItem.DeviceID & " Primary Bus Type: " & objItem.PrimaryBusType & " Secondary Bus Type: " & objItem.SecondaryBusType
'Module1.spr2.sdt = "Description: " & objItem.Description & "Device ID: " & objItem.DeviceID
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Primary Bus Type: " & objItem.PrimaryBusType
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Secondary Bus Type: " & objItem.SecondaryBusType
'Write #1, Module1.spr2.sdt
Next
'Write #1, " "
'Computer Architecture
List1.AddItem " "
'Module1.spr2.sdt = "Computer Architecture"
'Write #1, Module1.spr2.sdt
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colProcessors = objWMIService.ExecQuery _
("Select * From Win32_Processor")
For Each objProcessor In colProcessors
If objProcessor.Architecture = 0 Then
List1.AddItem Space(5) & "This is an x86 computer."
'Module1.spr2.sdt = "This is an x86 computer."
ElseIf objProcessor.Architecture = 1 Then
List1.AddItem Space(5) & "This is a MIPS computer."
'Module1.spr2.sdt = "This is a MIPS computer."
ElseIf objProcessor.Architecture = 2 Then
List1.AddItem Space(5) & "This is an Alpha computer."
'Module1.spr2.sdt = "This is an Alpha computer."
ElseIf objProcessor.Architecture = 3 Then
List1.AddItem Space(5) & "This is a PowerPC computer."
'Module1.spr2.sdt = "This is a PowerPC computer."
ElseIf objProcessor.Architecture = 6 Then
List1.AddItem Space(5) & "This is an ia64 computer."
'Module1.spr2.sdt = "This is an ia64 computer."
Else
List1.AddItem Space(5) & " The computer type could not be determined."
'Module1.spr2.sdt = "The computer type could not be determined."
End If
'Write #1, Module1.spr2.sdt
Next
'Processor Details
List1.AddItem " "
List1.AddItem Space(2) & "2. Processor"
List1.AddItem Space(2) & " -----------------"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colItems = objWMIService.ExecQuery("S
For Each objItem In colItems
List1.AddItem Space(5) & "Address Width: " & objItem.AddressWidth & " Architecture: " & objItem.Architecture & " Availability: " & objItem.Availability & " CPU Status: " & objItem.CpuStatus & " Current Clock Speed: " & objItem.CurrentClockSpeed & " Data Width: " & objItem.DataWidth & " Device ID: " & objItem.DeviceID
'Module1.spr2.sdt = "Address Width: " & objItem.AddressWidth
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Architecture: " & objItem.Architecture
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Availability: " & objItem.Availability
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "CPU Status: " & objItem.CpuStatus
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Current Clock Speed: " & objItem.CurrentClockSpeed
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Data Width: " & objItem.DataWidth
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Description: " & objItem.Description & "External Clock: " & objItem.ExtClock & "Family: " & objItem.Family & "L2 Cache Size: " & objItem.L2CacheSize
'Module1.spr2.sdt = "Description: " & objItem.Description
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Device ID: " & objItem.DeviceID
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "External Clock: " & objItem.ExtClock
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Family: " & objItem.Family
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "L2 Cache Size: " & objItem.L2CacheSize
'Write #1, Module1.spr2.sdt
'List1.AddItem "L2 Cache Speed: " & objItem.L2CacheSpeed
'List1.AddItem "Level: " & objItem.Level
'List1.AddItem "Load Percentage: " & objItem.LoadPercentage
List1.AddItem Space(5) & "Name: " & objItem.Name & " Manufacturer: " & objItem.Manufacturer & " Maximum Clock Speed: " & objItem.MaxClockSpeed & " Processor ID: " & objItem.ProcessorId
'Module1.spr2.sdt = "Manufacturer: " & objItem.Manufacturer
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Maximum Clock Speed: " & objItem.MaxClockSpeed
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Name: " & objItem.Name
'Write #1, Module1.spr2.sdt
'List1.AddItem "PNP Device ID: " & objItem.PNPDeviceID
'Module1.spr2.sdt = "Processor ID: " & objItem.ProcessorId
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Processor Type: " & objItem.ProcessorType & " Socket Designation: " & objItem.SocketDesignation & " Status Information: " & objItem.StatusInfo & " Stepping: " & objItem.Stepping & " Upgrade Method: " & objItem.UpgradeMethod
'Module1.spr2.sdt = "Processor Type: " & objItem.ProcessorType
'Write #1, Module1.spr2.sdt
'List1.AddItem "Revision: " & objItem.Revision
'List1.AddItem "Role: " & objItem.Role
'Module1.spr2.sdt = "Socket Designation: " & objItem.SocketDesignation
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Status Information: " & objItem.StatusInfo
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Stepping: " & objItem.Stepping
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Unique Id: " & objItem.UniqueId & " Version: " & objItem.Version
'Module1.spr2.sdt = "Unique Id: " & objItem.UniqueId
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Upgrade Method: " & objItem.UpgradeMethod
'Write #1, Module1.spr2.sdt
'Module1.spr2.sdt = "Version: " & objItem.Version
'Write #1, Module1.spr2.sdt
'List1.AddItem "Voltage Caps: " & objItem.VoltageCaps
Next
'On Board Devices
'Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
'Set colItems = objWMIService.ExecQuery("S
'List1.AddItem " "
'For Each objItem In colItems
'List1.AddItem "Description: " & objItem.Description
'List1.AddItem "Device Type: " & objItem.DeviceType
'List1.AddItem "Model: " & objItem.Model
'List1.AddItem "Name: " & objItem.Name
'List1.AddItem "Tag: " & objItem.Tag
'List1.AddItem "Version: " & objItem.Version
'Next
'Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
'Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
'For Each objSMBIOS In colSMBIOS
'List1.AddItem "Part Number: " & objSMBIOS.PartNumber
'List1.AddItem "Serial Number: " & objSMBIOS.SerialNumber
'List1.AddItem "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
'Next
'Accessing the Volatile Memory
Dim MS As MEMORYSTATUS
MS.dwLength = Len(MS)
GlobalMemoryStatus MS
List1.AddItem " "
'divide the memory variables by 1024 (nkb)
'to obtain the size in kilobytes
'List1.AddItem Format$(MS.dwMemoryLoad, "###,###,###,###") & " % used"
List1.AddItem Space(2) & "3. RAM: "
List1.AddItem Space(2) & " ---------"
'List1.AddItem " "
List1.AddItem Space(5) & "Memory: " & Format$(MS.dwTotalPhys / 1024, "###,###,###,###") & " Kbyte"
'Module1.spr2.sdt = "RAM" & Format$(MS.dwTotalPhys / 1024, "###,###,###,###") & " Kbyte"
'Write #1, Module1.spr2.sdt
'List1.AddItem Format$(MS.dwAvailPhys / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwTotalPageFile
'List1.AddItem Format$(MS.dwAvailPageFile
'List1.AddItem Format$(MS.dwTotalVirtual / 1024, "###,###,###,###") & " Kbyte"
'List1.AddItem Format$(MS.dwAvailVirtual / 1024, "###,###,###,###") & " Kbyte"
List1.AddItem " "
'ctr = 1
'Physical Disk Drive
Set DiskDriveSet = GetObject("winmgmts:{imper
InstancesOf("Win32_DiskDri
List1.AddItem Space(2) & "4. Details of Disk " '& ctr
List1.AddItem Space(2) & " --------------------------
'Module1.spr2.sdt = "Physical Details of Disk No. " & ctr
'Write #1, Module1.spr2.sdt
List1.AddItem ""
List1.AddItem Space(2) & " Physical Details- "
For Each dd In DiskDriveSet
List1.AddItem Space(5) & "Description : " & dd.Description & " Index= " & dd.Index & " DeviceID : " & dd.DeviceID & " Caption :" & dd.Caption
'Module1.spr2.sdt = "Description=" & dd.Description & " Index= " & dd.Index & " DeviceID= " & dd.DeviceID
'Write #1, Module1.spr2.sdt
List1.AddItem Space(5) & "Manufacturer : " & dd.Manufacturer & " Model : " & dd.Model & " Interface : " & dd.InterfaceType & " Media :" & dd.MediaLoaded & " " & dd.MediaType
'Module1.spr2.sdt = dd.Caption & " " & dd.Manufacturer & " " & dd.Model & " " & dd.InterfaceType & " " & dd.MediaLoaded & " " & dd.MediaType
'Write #1, Module1.spr2.sdt
'add physical info
List1.AddItem Space(5) & "Status=" & dd.Status & " Size:" & FormatNumber(dd.Size, 0) & " Partition:" & dd.Partitions
'Module1.spr2.sdt = "Status=" & dd.Status & " HDD:" & FormatNumber(dd.Size, 0) & " Partition=" & dd.Partitions
'Write #1, Module1.spr2.sdt
'List1.AddItem FormatNumber(dd.BytesPerSe
'List1.AddItem FormatNumber(dd.SectorsPer
'List1.AddItem FormatNumber(dd.TotalCylin
'note: the value for the TotalHeads property
'is obtained through extended functions of
'BIOS interrupt 13h. The value may be inaccurate
'if the drive uses a translation scheme to
'support high capacity disk sizes. Consult
'the manufacturer for accurate drive
'specifications
'List1.AddItem FormatNumber(dd.TotalHeads
'List1.AddItem FormatNumber(dd.TotalTrack
'List1.AddItem FormatNumber(dd.TracksPerC
ctr = ctr + 1
Next
'LogicalDrives
List1.AddItem ""
List1.AddItem Space(2) & " Logical Details- "
Call wmiLogicalDiskInfo
Call lvAutosizeControl(List1)
List1.AddItem " "
List1.AddItem Space(2) & "5. Keyboard "
List1.AddItem Space(2) & " ---------------"
Set wmiObjSet = GetObject("winmgmts:{imper
InstancesOf("Win32_Keyboar
For Each obj In wmiObjSet
List1.AddItem Space(5) & "Name: " & obj.Name & " Caption: " & obj.Caption & " Status: " & obj.Status
List1.AddItem Space(5) & "Description: " & obj.Description & IIf(obj.Availability, obj.Availability, "null") & "Layout: " & obj.Layout
List1.AddItem Space(5) & "No.of Function Keys: " & obj.NumberOfFunctionKeys & " DeviceID: " & obj.DeviceID & " PNP: " & obj.PNPDeviceID
Next
List1.AddItem " "
List1.AddItem Space(2) & "6. Network "
List1.AddItem Space(2) & " --------------"
Set NetAdapter = GetObject("winmgmts:").Ins
For Each na In NetAdapter
'Set itmx = na.DeviceID
'List1.AddItem "Device ID: " & na.DeviceID
List1.AddItem Space(5) & na.MACAddress & " " & na.AdapterType & " " & na.Manufacturer & " " & na.Description
Next
List1.AddItem " "
List1.AddItem Space(2) & "7. Monitor "
List1.AddItem Space(2) & " ------------"
Set dtmSet = GetObject("winmgmts:{imper
InstancesOf("Win32_Desktop
For Each dtm In dtmSet
'Set itmx = ListView1.ListItems.Add(, , dtm.DeviceID)
Select Case dtm.Availability
Case 1: msg = "other"
Case 2: msg = "unknown "
Case 3: msg = "running/full power"
Case 4: msg = "warning "
Case 5: msg = "in test "
Case 6: msg = "not applicable "
Case 7: msg = "power off "
Case 8: msg = "off line "
Case 9: msg = "off duty "
Case 10: msg = "degraded "
Case 11: msg = "not installed "
Case 12: msg = "install error "
Case 13: msg = "power save - unknown "
Case 14: msg = "power save - low power mode "
Case 15: msg = "power save - standby "
Case 16: msg = "power cycle "
Case 17: msg = "power save - warning "
Case 18: msg = "paused "
Case 19: msg = "not ready "
Case 20: msg = "not configured "
Case 21: msg = "quiesced"
End Select
List1.AddItem Space(5) & dtm.Caption & " " & dtm.MonitorManufacturer & " " & msg
Next
Set dcSet = GetObject("winmgmts:{imper
InstancesOf("Win32_Display
For Each dc In dcSet
'Set itmx = ListView1.ListItems.Add(, , dc.Caption)
List1.AddItem Space(5) & "Version=" & dc.DriverVersion & " Pixel =" & dc.LogPixels & " PelsHeight" & dc.PelsHeight & " Spec=" & dc.SpecificationVersion
Next
List1.AddItem " "
List1.AddItem " "
List1.AddItem Space(2) & "8. Printer Details "
List1.AddItem Space(2) & " ---------------------"
'printer
ReDim TabArray(0 To 1) As Long
TabArray(0) = 120
TabArray(1) = 191
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 2&, TabArray(0))
'List1.Refresh
Dim numPrinters As Long
numPrinters = EnumPrintersWinNT(List1)
List1.AddItem " "
List1.AddItem " "
List1.AddItem Space(2) & "9. Port Details "
List1.AddItem Space(2) & " -------------------"
'PORT
Dim numPorts As Long
ReDim TabArray(0 To 2) As Long
TabArray(0) = 65
TabArray(1) = 129
TabArray(2) = 188
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 3&, TabArray(0))
'List1.Refresh
numPorts = GetAvailablePorts(List1)
'BIOS Information
List1.AddItem " "
List1.AddItem Space(1) & "10. BIOS Details "
List1.AddItem Space(2) & " --------------------"
Set BiosSet = GetObject("winmgmts:{imper
InstancesOf("Win32_BIOS")
For Each bios In BiosSet
'Set itmx = ListView1.ListItems.Add(, , "PrimaryBIOS")
List1.AddItem Space(5) & "PrimaryBIOS: " & bios.PrimaryBIOS & " Status: " & bios.Status & " Caption: " & bios.Caption & " Description: " & bios.Description
List1.AddItem Space(5) & "Name: " & bios.Name & " Manufacturer: " & bios.Manufacturer & " ReleaseDate" & bios.ReleaseDate & " SerialNo.: " & bios.SerialNumber
'Set itmx = ListView1.ListItems.Add(, , "Status")
'For cnt = LBound(bios.BIOSVersion) To UBound(bios.BIOSVersion)
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "BIOSVersion strings", ""))
'List1.AddItem bios.BIOSVersion(cnt)
'Next
'Set itmx = ListView1.ListItems.Add(, , "Caption")
'Set itmx = ListView1.ListItems.Add(, , "Description")
'Set itmx = ListView1.ListItems.Add(, , "Name")
'Set itmx = ListView1.ListItems.Add(, , "Manufacturer")
'Set itmx = ListView1.ListItems.Add(, , "ReleaseDate")
'Set itmx = ListView1.ListItems.Add(, , "SerialNumber")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSBIOSVersion")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSMajorVersion")
'List1.AddItem Space(2) & " Version: " & " Major: " & bios.SMBIOSBIOSVersion & bios.SMBIOSMajorVersion & " Minor: " & bios.SMBIOSMinorVersion & " Present: " & bios.SMBIOSPresent
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSMinorVersion")
'Set itmx = ListView1.ListItems.Add(, , "SMBIOSPresent")
'Set itmx = ListView1.ListItems.Add(, , "SoftwareElementID")
'itmx.SubItems(1) = bios.SoftwareElementID
'Set itmx = ListView1.ListItems.Add(, , "SoftwareElementState")
Select Case bios.SoftwareElementState
Case 0: msg = "deployable"
Case 1: msg = "installable"
Case 2: msg = "executable"
Case 3: msg = "running"
End Select
List1.AddItem Space(5) & msg & " Version: " & bios.Version
'Set itmx = ListView1.ListItems.Add(, , "Version")
'Set itmx = ListView1.ListItems.Add(, , "InstallableLanguages")
'itmx.SubItems(1) = bios.InstallableLanguages
'Set itmx = ListView1.ListItems.Add(, , "CurrentLanguage")
'itmx.SubItems(1) = bios.CurrentLanguage
'For cnt = LBound(bios.ListOfLanguage
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "ListOfLanguages", ""))
'itmx.SubItems(1) = bios.ListOfLanguages(cnt)
'Next cnt
tot_msg = ""
For cnt = LBound(bios.BiosCharacteri
'Set itmx = ListView1.ListItems.Add(, , IIf(cnt = 0, "BIOS Characteristics", ""))
Select Case bios.BiosCharacteristics(c
Case 0: msg = "reserved"
Case 1: msg = "reserved"
Case 2: msg = "unknown"
Case 3: msg = "BIOS characteristics not supported"
Case 4: msg = "ISA supported"
Case 5: msg = "MCA supported"
Case 6: msg = "EISA supported"
Case 7: msg = "PCI supported"
Case 8: msg = "PC Card (PCMCIA) supported"
Case 9: msg = "Plug and Play supported"
Case 10: msg = "APM is supported"
Case 11: msg = "BIOS upgradable (Flash)"
Case 12: msg = "BIOS shadowing allowed"
Case 13: msg = "VL-VESA supported"
Case 14: msg = "ESCD support available"
Case 15: msg = "Boot from CD supported"
Case 16: msg = "Selectable boot supported"
Case 17: msg = "BIOS ROM socketed"
Case 18: msg = "Boot from PC card (PCMCIA) supported"
Case 19: msg = "EDD (Enhanced Disk Drive) specification supported"
Case 20: msg = "Int 13h, Japanese Floppy for NEC 9800 1.2mb (3.5, 1k b/s, 360 RPM) supported"
Case 21: msg = "Int 13h, Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) supported"
Case 22: msg = "Int 13h, 5.25 / 360 KB floppy services supported"
Case 23: msg = "Int 13h, 5.25 /1.2MB floppy services supported"
Case 24: msg = "Int 13h 3.5 / 720 KB floppy services supported"
Case 25: msg = "Int 13h, 3.5 / 2.88 MB floppy services supported"
Case 26: msg = "Int 5h, print screen service supported"
Case 27: msg = "Int 9h, 8042 keyboard services supported"
Case 28: msg = "Int 14h, serial services supported"
Case 29: msg = "Int 17h, printer services supported"
Case 30: msg = "Int 10h, CGA/Mono video aervices supported"
Case 31: msg = "NEC PC-98"
Case 32: msg = "ACPI supported"
Case 33: msg = "USB Legacy supported"
Case 34: msg = "AGP supported"
Case 35: msg = "I2O boot supported"
Case 36: msg = "LS-120 boot supported"
Case 37: msg = "ATAPI ZIP drive boot supported"
Case 38: msg = "1394 boot supported"
Case 39: msg = "Smart battery supported"
End Select
If Len(tot_msg) > 60 Then
List1.AddItem Space(5) & tot_msg
tot_msg = ""
Else
tot_msg = tot_msg & msg & " "
End If
Next 'For cnt
List1.AddItem Space(5) & tot_msg
Next 'For Each bios
'Slots
List1.AddItem Space(5)
'Close 1
https://www.experts-exchange.com/questions/20680011/System-info-Hardware-Devices.html?query=hardware+info&topics=93#8933523