本段代码为 三笑 所写,为了解决32位系统发现不了 4G内存的问题,可这段代码输出的数组列表,能不能改一下, ...
elexy 发表于 2011-10-2 10:17
不会吧?加个循环就解决了呀
#include <array.au3>
$x = getmem()
MsgBox(0, 0, $x)
Func getmem()
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output = ""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
Local $mem[1][2], $k = 1, $Count = 0
For $objItem In $colItems
ReDim $mem[$k + 1][2]
$Output = Execute($objItem.Capacity)
$mem[$k][0] = $objItem.BankLabel
$mem[$k][1] = $Output
$k += 1
Next
$mem[0][0] = UBound($mem) - 1
For $i = 0 To UBound($mem) - 1
$Count += $mem[$i][1]
Next
Return $Count
Else
MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_PhysicalMemory")
EndIf
EndFunc ;==>getmem
|