呵呵,恭喜楼主了。 虽然不懂怎么用,还是先顶顶
回复 17# _ddqs.
看下这样获取正确吗?如果不正确,请检查下WMI服务打开正常吗?
#include <array.au3>
$x=getmem()
_ArrayDisplay($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,$k=1
For $objItem In $colItems
ReDim $mem[$k+1]
$output=Execute($objItem.Capacity)
$mem[$k]=$objItem.BankLabel
$mem[$k]=$output
$k+=1
Next
$mem=UBound($mem)-1
Return $mem
Else
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_PhysicalMemory" )
Endif
EndFunc 又学到了许多东西了。哈哈。 支持一个,果然厉害...偶考虑的就没有那么全面了。。。 回18楼
测试还是空白
-----------------------
以下是网上找的教程,就能显示
;在Autoit中使用WMI:第一部分
;读物理内存的大小
$strComputer = "."
$wbemServices = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$wbemObjectSet= $wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For $wbemObject In $wbemObjectSet
;ConsoleWrite("Total Physical Memory (kb): " & $wbemObject.TotalPhysicalMemory)
ToolTip("Total Physical Memory (kb): " & $wbemObject.TotalPhysicalMemory)
Next
Sleep(5000)
嗯,好像WMI方式获取内存是有点问题的,我写的程式,老是会出问题...本来2G的内存,显示成4G,看样子还是用外挂CPUZ来取内存可能会好些,大不了慢一点。 #Include <WinAPIEx.au3>
_WinAPI_GetPerformanceInfo() 这个应该是准确的。
3mile 发表于 2010-10-23 10:18 http://www.autoitx.com/images/common/back.gif
简介的多了 回复 18# 3mile
3mile 你好,我想找些 api的资料(如你的代码中的内容),请问在哪儿可以找到相关资料?
谢谢啦 支持,学习了
页:
1
[2]