本帖最後由 rictirse 於 2014-12-24 08:38 編輯
很多朋友應該都用過 MemTest 這軟體來測試記憶體的穩定度,維修電腦或是超頻的好工具
但他有一個 很大的缺點,單一個檔案只能吃2GB的記憶體,所以16G的話需要開超多的個MemTest
這邊噹噹撰寫了一個檔案克服了這個問題,原始檔案在這邊:點我進入
這一支程式主要分為三個部份,因為au不支援原生的多線
所以噹噹把程式分為三個exe檔
GUI介面的「RunMemTest Pro v1.7.au3」
負責控制下面兩個exe,執行與開啟memtest
執行Memtest所使用的「RunMemTest.au3」
負責啟動Memtest的視窗,以及排序以及統計數量
啟動Memtest所使用的「StartMemTest.au3」
負責按下燒機那個按鈕
主程式原始碼
RunMemTest Pro v1.7.au3- #include <GUIConstantsEx.au3>
- #include <WinAPI.au3>
- #include <ScreenCapture.au3>
- AutoItSetOption ( "TrayIconHide", 1)
- #include <Timers.au3>
- Opt ("GUIResizeMode", $GUI_DOCKALL)
- $FileName = @ScriptDir&"memTestPro.exe"
- $Process = "memTestPro.exe"
- Global $X0 = 115
- Global $Y0 = 15
- Global $H = 20
- Global $W = 92
- Global $InputX = 23
- Global $InputY = 43
- Global $InputH = 20
- Global $BTN_X = 20
- Global $BTN_Y = 70
- Global $InputY = 43
- Global $GUI_W = 400, $GUI_H = 202
- Global $GUI_W_ReSize = 615, $GUI_H_ReSize = 202
- Global $DISTANCE = 8
- Global $reg = "HKCUSoftwareDangMenTest"
- Global $handle[1]
- Global $CompensateHandle
- Global $TitleName = "Run MemTest Pro Ver 1.7 CRS OC Team"
- RegWrite ( $reg, "TitleName", "REG_SZ", $TitleName)
- Global $Flag = 0,$flag2 = 0, $Updata = 1
- Global $slp= 0,$slp2 = 0
- Global $Solution_Set = 0, $RunMemtest_Set = 0, $StartMemTest_Set = 1, $CloseMemtest_Set = 0
- $GUI = GUICreate ( $TitleName, $GUI_W, $GUI_H)
- GUICtrlCreateLabel ( "(記憶體大小 X 開啟個數) = 總使用量 ; 剩餘記憶體 保留記憶體", $InputX-4, $Y0+2, 367,25)
- GUICtrlSetColor ( -1, 0x1260FF)
- GUICtrlSetFont ( -1, 9, 700)
- $Y0 = $Y0 + $H + $DISTANCE;計算出第二個 Y座標
- $size = GUICtrlCreateInput ( RegRead ( $reg, "MemSize"), $InputX, $InputY, 64,$H)
- GUICtrlSetColor ( -1, 0xEE7600)
- GUICtrlSetFont ( -1, 10, 700)
- $cnt = GUICtrlCreateInput ( RegRead ( $reg, "MemCnt"), $InputX+79, $Y0, 51,$H)
- GUICtrlSetColor ( -1, 0xEE7600)
- GUICtrlSetFont ( -1, 10, 700)
- If RegRead ( $reg, "retain") = "" Or RegRead ( $reg, "retain") = 0 Then
- $retainVer = 0
- Else
- $retainVer = RegRead ( $reg, "retain")
- EndIf
- $retain = GUICtrlCreateInput ( $retainVer, $InputX+289,$Y0, 65,$H)
- GUICtrlSetColor ( -1, 0xEE7600)
- GUICtrlSetFont ( -1, 10, 700)
- $total = GUICtrlCreateLabel ( "", $InputX+148, $Y0+1, 118,$H)
- GUICtrlSetFont ( -1, 10, 700)
- GUICtrlSetColor ( -1, 0xEE7600)
- If GUICtrlRead ($cnt) = "" Or GUICtrlRead ($size) = "" Then
- _Solution()
- Else
- $mem = MemGetStats()
- $TotalVer = ((GUICtrlRead ($size)*GUICtrlRead ($cnt)))
- $FreeVer =(($mem[2]/2^10)-$TotalVer)
- GUICtrlSetData ( $total, StringFormat ( "%dMB ; %dMB", $TotalVer, $FreeVer))
- EndIf
- $Auto = GUICtrlCreateButton ( "自動計算", $BTN_X, $BTN_Y,$W,$H+32)
- $run = GUICtrlCreateButton ( "啟動MemTest", $BTN_X+100, $BTN_Y,$W,$H+5)
- $Start = GUICtrlCreateButton ( "開始燒機", $BTN_X+100, $BTN_Y+28,$W,$H+5)
- $close = GUICtrlCreateButton ( "關閉MemTest", $BTN_X+200, $BTN_Y,$W,$H+5)
- $Stop = GUICtrlCreateButton ( "暫停MemTest", $BTN_X+200, $BTN_Y+28,$W,$H+5)
- $Help = GUICtrlCreateButton ( "使用說明", $BTN_X+200, $BTN_Y+28,$W,$H+5)
- $menu = GUICtrlCreateButton ( "→", $BTN_X+320, $BTN_Y+14, 30,$H+5)
- $Win_Pos = GUICtrlCreateButton ( "紀錄位置", 400, 15,$W,$H+5);紀錄位置
- GUICtrlSetState ( $Win_Pos, $GUI_DISABLE)
- GUICtrlSetState ( $Start, $GUI_DISABLE)
- ;~ GUICtrlSetState ( $Stop, $GUI_DISABLE)
- GUICtrlSetState ( $Stop, $GUI_HIDE)
- $Y0 = $Y0 + $H + $DISTANCE;計算出第二個 Y座標
- $Group_X = 405
- $Group_Y = 40
- GUICtrlCreateGroup ( "排列方法", $Group_X, $Group_Y+5, 85, 110)
- $Radio1 = GUICtrlCreateRadio ( "一般排列", $Group_X+10, $Group_Y+20,$W-25,$H+5)
- $Radio2 = GUICtrlCreateRadio ( "緊密排列", $Group_X+10, $Group_Y+40,$W-25,$H+5)
- $Radio3 = GUICtrlCreateRadio ( "堆疊排列", $Group_X+10, $Group_Y+60,$W-25,$H+5)
- $Radio4 = GUICtrlCreateRadio ( "自定義", $Group_X+10, $Group_Y+80,$W-25,$H+5)
- $Radio = RegRead ( $reg, "Radio")
- If $Radio = 2 Then
- GUICtrlSetState ( $Radio2, $GUI_CHECKED)
- ElseIf $Radio = 3 Then
- GUICtrlSetState ( $Radio3, $GUI_CHECKED)
- ElseIf $Radio = 4 Then
- GUICtrlSetState ( $Radio4, $GUI_CHECKED)
- Else;第一個
- GUICtrlSetState ( $Radio1, $GUI_CHECKED)
- EndIf
- GUICtrlCreateGroup ( "補償延遲(秒)", 505, 17, 85, 50)
- $slptime = GUICtrlCreateInput ( "", 515, 37, 64,$H)
- GUICtrlSetColor ( -1, 0xEE7600)
- GUICtrlSetFont ( -1, 10, 700)
- If RegRead ( $reg, "slptime") = "" Then
- GUICtrlSetData ( $slptime, 0);預設為0 關閉
- Else
- GUICtrlSetData ( $slptime, RegRead ( $reg, "slptime"))
- EndIf
- ;-------------自動截圖-------------
- $prt_check = GUICtrlCreateCheckbox ("啟動截圖", 508, 75, 80, 20)
- If RegRead ( $reg, "ptr_check") = 1 Then
- GUICtrlSetState ( $prt_check, $GUI_CHECKED)
- EndIf
- $prt_time = GUICtrlCreateInput ( "", 505, 100, 30, $H)
- If RegRead ( $reg, "prt_time") = "" Then
- GUICtrlSetData ( $prt_time, "5");預設為5分鐘
- Else
- GUICtrlSetData ( $prt_time, RegRead ( $reg, "prt_time"))
- EndIf
- GUICtrlCreateLabel ( "分鐘/張", 542, 104, 80, 25)
- $prt_rut = GUICtrlCreateButton ( "存檔路徑", 503, 127, 80, 25)
- GUICtrlSetState ( $prt_time, $GUI_DISABLE)
- GUICtrlSetState ( $prt_rut, $GUI_DISABLE)
- ptr_check_set()
- ;-------------end 自動截圖-------------
- If GUICtrlRead ($cnt) = "" Or GUICtrlRead ($size) = "" Then
- $RamVer = ""
- Else
- $mem = MemGetStats()
- $RamVer = StringFormat ( "總記憶體為:%d MB;可用記憶體為:%d MB", _
- ($mem[1]/(2^10)),($mem[2]/(2^10)))
- EndIf
- $RAMSIZE = GUICtrlCreateLabel ( $RamVer, 20, $BTN_Y+70, 371, 60)
- GUICtrlSetColor ( -1, 0x1260FF)
- GUICtrlSetFont ( -1, 10, 700)
- WinMove ($TitleName,"",Default,Default,$GUI_W,$GUI_H)
- ;~ WinMove ($TitleName,"",Default,Default,$GUI_W_ReSize,$GUI_H_ReSize)
- WinSetOnTop ($GUI, "", 1)
- GUISetState()
- While 1
- _Save( $size, "MemSize")
- _Save( $cnt, "MemCnt")
- _Save( $retain, "retain")
- _Save( $slptime, "slptime")
- _Save( $prt_time, "prt_time")
- If $Solution_Set = 0 Then
- HotKeySet ("{F5}","_Solution");自動計算
- Else
- HotKeySet ("{F5}","_nothing")
- EndIf
- If $RunMemtest_Set = 0 Then
- HotKeySet ("{F6}","_RunMemtest");開啟Memtest
- Else
- HotKeySet ("{F6}","_nothing")
- EndIf
- If $StartMemTest_Set = 0 Then
- HotKeySet ("{F7}","_StartMemTest");燒機開始
- ElseIf $StartMemTest_Set = 2 Then
- HotKeySet ("{F7}","_StopMemTest");暫停MemTest
- Else
- HotKeySet ("{F7}","_nothing")
- EndIf
- HotKeySet ("{F8}","_CloseMemtest");關閉MemTest
- $msg = GUIGetMsg()
- If $msg = $Radio1 And BitAND(GUICtrlRead ($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then
- RegWrite( $reg, "Radio", "REG_SZ", 1)
- EndIf
- If $msg = $Radio2 And BitAND(GUICtrlRead ($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then
- RegWrite( $reg, "Radio", "REG_SZ", 2)
- EndIf
- If $msg = $Radio3 And BitAND(GUICtrlRead ($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then
- RegWrite( $reg, "Radio", "REG_SZ", 3)
- EndIf
- If $msg = $Radio4 And BitAND(GUICtrlRead ($Radio4), $GUI_CHECKED) = $GUI_CHECKED Then
- If RegRead ( $reg,"MemTestPos_array") = "" Or RegRead ( $reg,"MemTestPos_array") = 0 Then
- GUICtrlSetState ( $Radio1, $GUI_CHECKED)
- RegWrite ( $reg, "Radio", "REG_SZ", 1)
- WinSetOnTop ( $GUI, "", 0)
- MsgBox ( 16, $TitleName, "尚未有自定義座標")
- WinSetOnTop ( $GUI, "", 1)
- Else
- RegWrite ( $reg, "Radio", "REG_SZ", 4)
- EndIf
- EndIf
- If $msg = $prt_check Then
- ptr_check_set()
- EndIf
- $mem = MemGetStats()
- $RamVer = StringFormat ( "總記憶體為:%d MB;可用記憶體為:%d MB", _
- ($mem[1]/(2^10)),($mem[2]/(2^10)))
- If GUICtrlRead ($RAMSIZE) <> $RamVer Then
- GUICtrlSetData ( $RAMSIZE, $RamVer)
- EndIf
- If $Flag = 1 Then
- If $Updata = 1 Then
- $Updata = 0
- _GetyMemTestListPid()
- EndIf
- Dim $_cnt = GUICtrlRead ($cnt)
- For $i = 0 To $_cnt
- If StringLen (ControlGetText ($handle[$i],"","Edit2")) > 17 Then
- ;~ ToolTip("")
- _prt_sc()
- _CloseMemtest()
- ExitLoop
- EndIf
- Next
- ;~ $Str = StringFormat (@CRLF&" 截圖:%f秒 "&@CRLF&" 補償:%f秒 "&@CRLF&" 剩餘記憶體:%dMB"&@CRLF&" ",($slp2/1000/3),($slp/1000/3),($mem[2]/(2^10)))
- ;~ ToolTip ($Str)
- If BitAND (GUICtrlRead ($prt_check), $GUI_CHECKED) = $GUI_CHECKED Then
- $slp2 += 50
- If $slp2 > (GUICtrlRead($prt_time)*1000*3*60) Then;自動截圖
- ;~ ToolTip("")
- _prt_sc()
- $slp2 = 0
- If GUICtrlRead($slptime) <> 0 Then
- Sleep (50)
- Else
- Sleep (25)
- EndIf
- EndIf
- EndIf
- If GUICtrlRead ($slptime) <> 0 Then
- $slp += 50
- If $slp > (GUICtrlRead ($slptime)*1000*3) Then;壓榨記憶體模式
- If GUICtrlRead ($retain) < Int ($mem[2]/(2^10)) Then
- $slp = 0
- $i = GUICtrlRead ($cnt)
- If $flag2 = 0 Then
- $Memory =Int($mem[2]/(2^10))
- $flag2 = 1
- $CompensateHandle = WinGetHandle ("[0 errors] MemTest", "保留記憶體使用")
- Else
- $Memory = Int($Memory+($mem[2]/(2^10)))
- ControlClick ( $CompensateHandle, "", "Button2");按暫停
- EndIf
- ;~ winclose ($CompensateHandle)
- ControlSetText ($CompensateHandle, "", "Edit1", $Memory)
- ControlClick ( $CompensateHandle, "", "Button1")
- If BitAND ( GUICtrlRead ($prt_check), $GUI_CHECKED) = $GUI_CHECKED Then
- Sleep (50)
- Else
- Sleep (25)
- EndIf
- EndIf
- EndIf
- EndIf
- EndIf
- Switch $msg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $Auto
- _Solution()
- Case $run
- _RunMemtest()
- Case $Start
- _StartMemTest()
- Case $close
- _CloseMemtest()
- Case $Stop
- _StopMemTest()
- Case $Help
- GUISetState (@SW_HIDE)
- MsgBox ( 0, $TitleName&" 使用教學", _
- "1. 自動計算公式為 ( 執行緒數量 / 總記憶體 )"&@CRLF& _
- " 大於2047MB則多開一個,直到小餘2047MB。"&@CRLF&@CRLF& _
- "2. 快速鍵:"&@CRLF& _
- " F5 → 自動計算"&@CRLF& _
- " F6 → 開啟MemTest"&@CRLF& _
- " F7 → 燒機"&@CRLF& _
- " F8 → 關閉全部MemTest "&@CRLF& _
- " 請愛用快速鍵,反應速度比較快。"&@CRLF&@CRLF& _
- "3. 燒機後 (剩餘記憶體) 大於 (保留記憶體) 會啟動 (自動補償),"&@CRLF& _
- " (自動補償) 會把剩餘記憶體全部放在保留記憶體的Mem內,"&@CRLF& _
- " 設定時間 0 則不啟動,預設補償時間0秒,不啟動。"&@CRLF&@CRLF& _
- "4. 截圖預設路徑為桌面。"&@CRLF&@CRLF& _
- "")
- GUISetState (@SW_SHOW)
- Case $Menu
- _Menu()
- Case $prt_rut
- _prt_rut()
- Case $Win_Pos
- _Win_Pos()
- EndSwitch
- WEnd
- Func _Solution()
- $mem = MemGetStats()
- $MemCnt = _LogicalCore()
- Do
- $MemSize = Int ($mem[2]/(2^10)/$MemCnt)
- If $MemSize > 2047 Then
- $MemCnt += 1
- EndIf
- Until ($MemSize <= 2047)
- GUICtrlSetData ($size,$MemSize)
- GUICtrlSetData ($cnt,$MemCnt)
- EndFunc
- Func _RunMemtest()
- _CloseMemtest()
- GUICtrlSetState ( $size, $GUI_DISABLE)
- GUICtrlSetState ( $cnt, $GUI_DISABLE)
- GUICtrlSetState ( $Auto, $GUI_DISABLE)
- If $retain <> 0 Then;如果開啟記憶體補償
- GUICtrlSetState ( $slptime, $GUI_DISABLE)
- EndIf
- $Solution_Set = 1
- $RunMemtest_Set = 1
- $StartMemTest_Set = 1
- If GUICtrlRead ($cnt) = "" Or GUICtrlRead ($size) = "" Or GUICtrlRead ($cnt) = 0 Or GUICtrlRead ($size) = 0 Or Int (GUICtrlRead ($size)/GUICtrlRead ($cnt)) < 0 Then Return
- If @error = 1 Then Return
- Dim $_cnt = GUICtrlRead ($cnt)
- ReDim $handle[$_cnt+1]
- If BitAND(GUICtrlRead ($Radio4), $GUI_CHECKED) = $GUI_CHECKED Then;如果勾選自定義
- If $_cnt > RegRead ( $reg, "MemTestPos_array") Then;如果自訂的arr 小於 開啟量則
- WinSetOnTop ( $GUI, "", 0)
- $nMsg = MsgBox ( 36, $TitleName, "Memtest 數量大於自定義的座標量,是否繼續執行?"&@CRLF&@CRLF&"超過的座標皆為0,0")
- WinSetOnTop ( $GUI, "", 1)
- If $nMsg = 7 Then Return
- EndIf
- EndIf
- Run ("RunMemTest.exe");啟動Memtest
- GUICtrlSetState ( $Win_Pos, $GUI_ENABLE)
- GUICtrlSetState ( $Start, $GUI_ENABLE)
- $StartMemTest_Set = 0
- EndFunc
- Func _Save( $Input, $RegName)
- If GUICtrlRead ($Input) <> RegRead ( $reg, $RegName) Then
- RegWrite( $reg, $RegName, "REG_SZ", GUICtrlRead($Input))
- If GUICtrlRead ($size) > 2048 Then
- GUICtrlSetData ( $size, 2048)
- WinSetOnTop ($GUI,"",0)
- MsgBox (16,"ERROR","不得大於2048", 1)
- WinSetOnTop ($GUI,"",1)
- EndIf
- If GUICtrlRead ($Input) <> "" Then
- $mem = MemGetStats()
- $TotalVer = ((GUICtrlRead ($size)*GUICtrlRead ($cnt)))
- $FreeVer =(($mem[2]/2^10)-$TotalVer)
- $Var = StringFormat ( "%dMB ; %dMB", $TotalVer, $FreeVer)
- GUICtrlSetData ( $Total, $Var)
- EndIf
- EndIf
- EndFunc
- Func _Win_Pos()
- Dim $_cnt = GUICtrlRead ($cnt)
- If GUICtrlRead ($slptime) <> 0 Then;確定開啟的數量 如果不開啟補償 少開一個
- $_cnt += 1
- EndIf
- _GetyMemTestListPid()
- For $i = 0 To ($_cnt-1)
- $Pos = WinGetPos ($handle[$i])
- RegWrite ( $reg, "MemTestPos_array", "REG_SZ", $_cnt)
- RegWrite ( $reg, "MemTestPos["&$i&"]_X", "REG_SZ", $Pos[0])
- RegWrite ( $reg, "MemTestPos["&$i&"]_Y", "REG_SZ", $Pos[1])
- Next
- GUISetState (@SW_HIDE)
- MsgBox ( 0, $TitleName, "紀錄完成,共"&$_cnt&"組", 1)
- GUISetState (@SW_SHOW)
- EndFunc
- Func _StartMemTest()
- $Solution_Set = 1
- $RunMemtest_Set = 1
- $StartMemTest_Set = 1
- If ProcessExists ($Process) = 0 Then Return
- GUICtrlSetState ( $Auto, $GUI_DISABLE)
- GUICtrlSetState ( $run, $GUI_DISABLE)
- GUICtrlSetState ( $Win_Pos, $GUI_DISABLE)
- GUICtrlSetState ( $Start, $GUI_DISABLE)
- GUICtrlSetState ( $Stop, $GUI_ENABLE)
- Run ("StartMemTest.exe")
- $Flag = 1
- $StartMemTest_Set = 2
- EndFunc
- Func _StopMemTest()
- $slp= 0
- $slp2 = 0
- If ProcessExists ($Process) = 0 Then Return
- $StartMemTest_Set = 1
- $Updata = 1
- ;~ Run ("StopMemTest.exe")
- $Flag = 0
- GUICtrlSetState ( $Start, $GUI_ENABLE)
- $Solution_Set = 1
- $RunMemtest_Set = 1
- $StartMemTest_Set = 0
- EndFunc
- Func _CloseMemtest()
- ToolTip (@CRLF&" 結束MemTest "&@CRLF&" ")
- $slp= 0
- $slp2 = 0
- GUICtrlSetState ( $Win_Pos, $GUI_DISABLE)
- GUICtrlSetState ( $Start, $GUI_DISABLE)
- Do
- ProcessClose ("RunMemTest.exe")
- Until ProcessExists ("RunMemTest.exe") = 0
- Do
- ProcessClose ("StartMemTest.exe")
- Until ProcessExists ("StartMemTest.exe") = 0
- ;~ Do
- ;~ ProcessClose ("StopMemTest.exe")
- ;~ Until ProcessExists ("StopMemTest.exe") = 0
- Do
- ProcessClose ($Process)
- Until ProcessExists ($Process) = 0
- If $retain <> 0 Then;如果開啟記憶體補償
- GUICtrlSetState ( $slptime, $GUI_ENABLE)
- EndIf
- $Flag = 0
- $flag2 = 0
- $Updata = 0
- $Solution_Set = 0
- $RunMemtest_Set = 0
- $StartMemTest_Set = 1
- GUICtrlSetState ( $Auto, $GUI_ENABLE)
- GUICtrlSetState ( $run, $GUI_ENABLE)
- GUICtrlSetState ( $Stop, $GUI_DISABLE)
- GUICtrlSetState ( $size, $GUI_ENABLE)
- GUICtrlSetState ( $cnt, $GUI_ENABLE)
- ToolTip ("")
- EndFunc
- Func _Menu()
- If GUICtrlRead ($Menu) = "←" Then
- GUICtrlSetData ( $Menu, "→")
- WinMove ($TitleName,"",Default,Default,$GUI_W,$GUI_H)
- Else
- GUICtrlSetData ( $Menu, "←")
- WinMove ($TitleName,"",Default,Default,$GUI_W_ReSize,$GUI_H_ReSize)
- EndIf
- EndFunc
- Func _prt_rut()
- WinSetOnTop ($GUI, "", 0)
- $rut = FileSelectFolder ( "請選擇存檔目錄", @DesktopDir, 3)
- RegWrite( $reg, "prt_rut", "REG_SZ", $rut)
- WinSetOnTop ($GUI, "", 1)
- EndFunc
- Func ptr_check_set()
- If BitAND(GUICtrlRead ($prt_check), $GUI_CHECKED) = $GUI_CHECKED Then
- GUICtrlSetState ( $prt_time, $GUI_ENABLE)
- GUICtrlSetState ( $prt_rut, $GUI_ENABLE)
- RegWrite( $reg, "ptr_check", "REG_SZ", 1)
- Else
- GUICtrlSetState ( $prt_time, $GUI_DISABLE)
- GUICtrlSetState ( $prt_rut, $GUI_DISABLE)
- RegWrite( $reg, "ptr_check", "REG_SZ", 0)
- EndIf
- EndFunc
- Func _WinWaitClick ( $Title, $TextName, $controlID)
- If Not WinActivate ( $Title, $TextName) Then
- WinActivate ( $Title, $TextName)
- WinWaitActive ( $Title, $TextName)
- EndIf
- ControlClick ( $Title, $TextName, $controlID)
- EndFunc
- Func _CPU_Utilization()
- $wbemServices = ObjGet("winmgmts:\.rootcimv2")
- $wbemObjectSet= $wbemServices.ExecQuery("Select * from Win32_Processor")
- For $wbemObject In $wbemObjectSet
- $dd=$wbemObject.LoadPercentage
- Next
- Return $dd
- EndFunc
- Func _LogicalCore()
- $aSysInfo = _WinAPI_GetSystemInfo()
- $PROCESS_ALL_ACCESS = 0x1F0FFF
- $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, @AutoItPID)
- $aRet = _WinAPI_GetProcessAffinityMask($hProc)
- Return (Log($aRet[2] + 1) / Log(2))
- EndFunc
- Func _WinAPI_GetSystemInfo($iInformation=-1)
- If $iInformation<>-1 And ($iInformation<1 Or $iInformation>10) Then Return SetError(1,0,-1)
- Local $aRet,$stSystemInfo=DllStructCreate("ushort;short;dword;ptr;ptr;dword;dword;dword;dword;short;short")
- $aRet=DllCall("kernel32.dll","none","GetSystemInfo","ptr",DllStructGetPtr($stSystemInfo))
- If @error Or Not IsArray($aRet) Then Return SetError(2,0,-1)
- If $iInformation<>-1 Then
- If $iInformation==1 Then Return DllStructGetData($stSystemInfo,1)
- Return DllStructGetData($stSystemInfo,$iInformation+1)
- EndIf
- Local $aSysInfo[10]
- $aSysInfo[0]=DllStructGetData($stSystemInfo,1)
- For $i=1 To 9
- $aSysInfo[$i]=DllStructGetData($stSystemInfo,$i+2)
- Next
- Return $aSysInfo
- EndFunc
- Func _prt_sc()
- If RegRead ( $reg, "prt_rut") = "" Then
- $rut = @DesktopDir
- Else
- $rut = RegRead ( $reg, "prt_rut")
- EndIf
- If Not FileExists ($rut) Then
- $rut = @DesktopDir
- EndIf
- GUISetState(@SW_HIDE)
- Sleep (1000)
- _ScreenCapture_Capture($rut&""&@YEAR&"_"&@MON&"_"&@MDAY&"_"&@HOUR&"_"&@MIN&"_"&@SEC&".png")
- GUISetState(@SW_SHOW)
- EndFunc
- Func _GetyMemTestListPid()
- $var = WinList()
- Local $_cnt = GUICtrlRead ($cnt)
- If GUICtrlRead ($slptime) <> 0 Then;確定開啟的數量 如果不開啟補償 少開一個
- $_cnt += 1
- EndIf
- Local $j = 0
- ReDim $handle[$_cnt]
- For $i = 1 To $var[0][0]
- If StringCompare ( $var[$i][0], "[0 errors] MemTest ", 1) = 0 Or StringCompare ( $var[$i][0], "[0 errors] MemTest", 1) = 0 Then
- $find = True
- Else
- $find = False
- EndIf
- If $find = True Then
- $handle[$j] =$var[$i][1]
- $j += 1
- $find = False
- EndIf
- Next
- EndFunc
- Func _nothing()
- EndFunc
複製代碼 |