Reply to Monitoring a process
From: Avatar Viper (chuayongquan_at_hotmail.com)
Date: 12/16/04
- Next message: Nicholas Ring: "Re: Simulating the button click event programatically ...."
- Previous message: Johan Smit: "Re: Breakpoint does not break"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Dec 2004 19:13:04 -0800
I have done up a sample code for monitoring process, pls give some comments
[CODE]
procedure Monitor_Thread.Execute;
begin
SetName;
{ Place thread code here }
while(true) do begin
ListProcess();
Sleep(100);
end
end;
procedure Monitor_Thread.ListProcess();
var
proc : PROCESSENTRY32;
hSnap : HWND;
Looper : BOOL;
ExeName : String;
begin
proc.dwSize := SizeOf(Proc);
hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
Looper := Process32First(hSnap,proc);
while Integer(Looper) <> 0 do
begin
ExeName := ExtractFileName(proc.szExeFile);
if ExeName = 'flashget.exe' then begin
Form1.ShowMsg(ExeName+' is running');
{ Suspend(); }
end;
Looper := Process32Next(hSnap,proc);
end;
CloseHandle(hSnap);
end;
[/CODE]
And do you guys knows what is the best sleep time???
- Next message: Nicholas Ring: "Re: Simulating the button click event programatically ...."
- Previous message: Johan Smit: "Re: Breakpoint does not break"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]