回复 11# jasmine
查看 _WinAPI_GetProcessMemoryInfo() 找原因; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetProcessMemoryInfo
; Description....: Retrieves information about the memory usage of the specified process.
; Syntax.........: _WinAPI_GetProcessMemoryInfo ( [$PID] )
; Parameters.....: $PID - The PID of the process. Default (0) is the current process.
; Return values..: Success - The array that contains the following information.
;
; [0] - The number of page faults.
; [1] - The peak working set size, in bytes.
; [2] - The current working set size, in bytes.
; [3] - The peak paged pool usage, in bytes.
; [4] - The current paged pool usage, in bytes.
; [5] - The peak nonpaged pool usage, in bytes.
; [6] - The current nonpaged pool usage, in bytes.
; [7] - The current space allocated for the pagefile, in bytes.
; [8] - The peak space allocated for the pagefile, in bytes.
; [9] - The current amount of memory that cannot be shared with other processes, in bytes.
;
; Failure - 0 and sets the @error flag to non-zero.
; Author.........: Yashied
; Modified.......:
; Remarks........: None
; Related........:
; Link...........: @@MsdnLink@@ GetProcessMemoryInfo
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_GetProcessMemoryInfo($PID = 0)
If Not $PID Then
$PID = _WinAPI_GetCurrentProcessID()
If Not $PID Then
Return SetError(1, 0, 0)
EndIf
EndIf
Local $hProcess = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'dword', 0x00000410, 'int', 0, 'dword', $PID)
If (@error) Or (Not $hProcess[0]) Then
Return SetError(1, 0, 0)
EndIf
Local $tPMC_EX = DllStructCreate('dword;dword;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr')
Local $Ret = DllCall(@SystemDir & '\psapi.dll', 'int', 'GetProcessMemoryInfo', 'ptr', $hProcess[0], 'ptr', DllStructGetPtr($tPMC_EX), 'int', DllStructGetSize($tPMC_EX))
If (@error) Or (Not $Ret[0]) Then
$Ret = 0
EndIf
_WinAPI_CloseHandle($hProcess[0])
If Not IsArray($Ret) Then
Return SetError(1, 0, 0)
EndIf
Local $Result[10]
For $i = 0 To 9
$Result[$i] = DllStructGetData($tPMC_EX, $i + 2)
Next
Return $Result
EndFunc ;==>_WinAPI_GetProcessMemoryInfo
|