vb6如何最简单代码获取内存大小,硬盘大小,电脑型号和cpu型号(主频大小)等信息?
有一句话代码吗?
能搜到的都是很复杂很长的代码.
用vbs可不可以呢?
Thanks!
[解决办法]
set wmi=GetObject("winmgmts:\\.\root\CIMV2")
set w=wmi.ExecQuery("select * from win32_processor")
a="CPU名称"
for each i in w
a=a & vbcrlf & i.Name
next
set w=wmi.ExecQuery("select * from win32_ComputerSystem")
a=a & vbcrlf & vbcrlf & "内存大小"
for each i in w
a=a & vbcrlf & i.TotalPhysicalMemory
next
set w=wmi.ExecQuery("select * from win32_DiskDrive")
a=a & vbcrlf & vbcrlf & "硬盘大小"
for each i in w
a=a & vbcrlf & i.Size
next
set w=wmi.ExecQuery("select * from win32_LogicalDisk where DriveType='3'")
a=a & vbcrlf & vbcrlf & "盘符----大小"
for each i in w
a=a & vbcrlf & i.DeviceID & " ---- " & i.Size
next
set w=wmi.ExecQuery("select * from win32_NetworkAdapter")
a=a & vbcrlf & vbcrlf & "网络适配器"
for each i in w
a=a & vbcrlf & i.ProductName
next
Set w = wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")
a=a & vbcrlf & vbcrlf & "MAC地址"
For Each i in w
a=a & vbcrlf & i.MACAddress
Next
set w=wmi.ExecQuery("select * from win32_VideoController")
a=a & vbcrlf & vbcrlf & "显卡型号----显存"
for each i in w
a=a & vbcrlf & i.Name & " ---- " & i.AdapterRAM
next
Set FSO = CreateObject("Scripting.FileSystemObject")
set f=fso.opentextfile("xinxi.txt",2,true)
f.write "电脑信息:" & vbcrlf & vbcrlf & a
f.close
msgbox "OK"
说明:程序运行约2s(因为读取硬件信息)
部分程序命令可能出错(电脑禁用),请反馈给我,修改程序
结果保存为“xinxi.txt”,计算机名若含有不能作为文件名的特殊字符将无法创建文件
外网IP地址通常是变化的,需要联网才知道IP地址(我没有编写)
内网IP地址对于上网没什么用,所以我没有编写
[解决办法]
http://topic.csdn.net/t/20030115/16/1361797.html
[解决办法]
http://www.vbgood.com/thread-103820-1-1.html