Entwickler-Ecke
Windows API - Task list with memory usage?
chukalv - So 21.05.06 18:25
Titel: Task list with memory usage?
Is there aposibilliaty to get the windows task list WITH the memory usage of every task? Maybe any components? Found some scripts, but there are eithe usings dll`s or just showing the tasks without the memory usage...
Thanks!
digi_c - Mo 22.05.06 09:13
Im not a WinAPI freak but the procedure is that you have to enumerate all processes and to get further informations by using the determined PIDs. Processexplorer from sysinternals.com is OSS so you might have a look at it. But i guess that there's better delphi code but for english this might be the wrong place ;-)
chukalv - Mo 22.05.06 14:10
Will have a look to the Processexplorer at home (at my job it doesn`t likes the name, because of a stupid proxy filter - Processexplorer :x )
How to get the PID`s from the current running processes I know. But I can`t find ANY documentation how to get the memory usage from it..
P.S. Understand German is not a problem for me...Just with the writting.. :oops:
chukalv - Mo 22.05.06 19:07
digi_c: Sorry. but didn`t found any source code of the Processes Explorer..
About this one code:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
| var pmc: PPROCESS_MEMORY_COUNTERS; cb: Integer; begin cb := SizeOf(_PROCESS_MEMORY_COUNTERS); GetMem(pmc, cb); pmc^.cb := cb; if GetProcessMemoryInfo(GetCurrentProcess(), pmc, cb) then Label1.Caption := IntToStr(pmc^.WorkingSetSize) + ' Bytes' else Label1.Caption := 'Unable to retrieve memory usage structure';
FreeMem(pmc); |
It`s showing my projects memory usage, but how to change it so that it`s showing the memory of any given process from it`s process name or PID?
Didn`t found any other code examples...
0xCC - Mo 22.05.06 19:42
chukalv hat folgendes geschrieben: |
digi_c: Sorry. but didn`t found any source code of the Processes Explorer..
About this one code:
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
| var pmc: PPROCESS_MEMORY_COUNTERS; cb: Integer; begin cb := SizeOf(_PROCESS_MEMORY_COUNTERS); GetMem(pmc, cb); pmc^.cb := cb; if GetProcessMemoryInfo(GetCurrentProcess(), pmc, cb) then Label1.Caption := IntToStr(pmc^.WorkingSetSize) + ' Bytes' else Label1.Caption := 'Unable to retrieve memory usage structure';
FreeMem(pmc); |
It`s showing my projects memory usage, but how to change it so that it`s showing the memory of any given process from it`s process name or PID?
Didn`t found any other code examples... |
use openprocess instead of getcurrentprocess...
Delphi-Quelltext
1: 2: 3: 4: 5:
| var prochnd: thandle procHnd := OpenProcess( PROCESS_QUERY_INFORMATION,false,ProcessID); GetProcessMemoryInfo(prochnd, pmc, cb)...
CloseHandle(prochnd); |
Entwickler-Ecke.de based on phpBB
Copyright 2002 - 2011 by Tino Teuber, Copyright 2011 - 2025 by Christian Stelzmann Alle Rechte vorbehalten.
Alle Beiträge stammen von dritten Personen und dürfen geltendes Recht nicht verletzen.
Entwickler-Ecke und die zugehörigen Webseiten distanzieren sich ausdrücklich von Fremdinhalten jeglicher Art!