hum ! la question qui tue !

ps: je sais deja avoir la liste des process
mais pas moyen d'avoir leur emplacement memoire; taille ...

Code : Tout sélectionner
;structure nécessaire pour obtenir l'usage mémoire
Structure PROCESS_MEMORY_COUNTERS
cb.l
PageFaultCount.l
PeakWorkingSetSize.l
WorkingSetSize.l
QuotaPeakPagedPoolUsage.l
QuotaPagedPoolUsage.l
QuotaPeakNonPagedPoolUsage.l
QuotaNonPagedPoolUsage.l
PagefileUsage.l
PeakPagefileUsage.l
EndStructure
ProcedureDLL GetProcessMemory(PID.l) ; mémoire vive utilisée
pmc.PROCESS_MEMORY_COUNTERS
hProcess.l = OpenProcess_(#PROCESS_QUERY_INFORMATION|#PROCESS_VM_READ, #False, PID)
If OpenLibrary(0,"PSAPI.DLL")
*F=GetFunction(0,"GetProcessMemoryInfo")
If *F
CallFunctionFast(*F,hProcess,@pmc,SizeOf(pmc))
GetProcessusSize = pmc\WorkingSetSize
Else
CloseLibrary(0)
End
EndIf
Else
End
EndIf
ProcedureReturn GetProcessusSize
EndProcedure
ProcedureDLL GetProcessPagefile(PID.l) ; mémoire paginée
pmc.PROCESS_MEMORY_COUNTERS
hProcess.l = OpenProcess_(#PROCESS_QUERY_INFORMATION|#PROCESS_VM_READ, #False, PID)
If OpenLibrary(0,"PSAPI.DLL")
*F=GetFunction(0,"GetProcessMemoryInfo")
If *F
CallFunctionFast(*F,hProcess,@pmc,SizeOf(pmc))
GetProcessusPagefileUsage = pmc\PagefileUsage
Else
CloseLibrary(0)
End
EndIf
Else
End
EndIf
ProcedureReturn GetProcessusPagefileUsage
EndProcedure
;exemples de récup avec un identifiant de process correct...
Memory = Str(GetProcessMemory(pid)/1024)+" ko"
PageFile = Str(GetProcessPagefile(pid)/1024)+" ko"
Code : Tout sélectionner
hProcess.l = OpenProcess_( #PROCESS_ALL_ACCESS, #False, PID )
Code : Tout sélectionner
hProcess.l = OpenProcess_(#PROCESS_QUERY_INFORMATION|#PROCESS_VM_READ, #False, PID)