Helo All,
I have worked out how to retrieve a list of processes via:
var
pSnapShot: Hwnd ;
pe32: ProcessEntry32 ;
Handle: Hwnd ;
CreationTime, ExitTime, KernelTime, UserTime: _FileTime ;
SystemTime: _SystemTime ;
CPUTime: TTime ;
PID: String ;
begin
pSnapShot := CreateToolHelp32SnapShot(TH32CS_SnapProcess, 0) ;
pe32.dwSize := sizeOf(ProcessEntry32) ;
if Process32First(pSnapShot, pe32) then
repeat
PID := InttoStr(pe32.th32ProcessID) ;
Handle := OpenProcess(PROCESS_ALL_ACCESS, False, pe32.th32ProcessID) ;
GetProcessTimes(Handle, CreationTime, ExitTime, KernelTime, UserTime)
;
CloseHandle(Handle) ;
FiletimetoSystemTime(KernelTime, Systemtime) ;
CPUTime := SystemTimetoDateTime(SystemTime) ;
until not Process32Next(pSnapShot, pe32) ;
CloseHandle(pSnapShot) ;
end ;
PID returns the correct Process ID, CPUTime returns close to the CPU Time
reported in Task Manager, the question is:
How do I find out the "Mem Usage" as reported in Task Manager?
Also, CPUTime reports differently from Task Manager. Is there another way of
getting this?
Cheers,
Dave.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/