Вниз
Скачать: CL | DM;

как отслеживать в Delphi существование процессоов?   Найти похожие ветки 

← →
ArtAlex ©   (2003-08-18 20:59) [0]

как отслеживать в Delphi существование процессоов? тоесть мне надо,чтоб по завершению раюоты приложения, комп выключался. Как отследмит процесс существования этого приложения?


← →
Дмитрий В. Белькевич ©   (2003-08-19 01:09) [1]

Если сам запускал, и есть хэндл - по нему. Если нет - перебирай все процессы. FindFirstProcess / FindNext etc. Сам не пользовал, но afair так.


← →
Дмитрий В. Белькевич ©   (2003-08-19 21:21) [2]

function IsRunning(sName: string): boolean;
var
han: THandle;
ProcStruct: PROCESSENTRY32; // from "tlhelp32" in uses clause
sID: string;
begin
Result := false;
// Get a snapshot of the system
han := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
if han = 0 then
exit;
// Loop thru the processes until we find it or hit the end
ProcStruct.dwSize := sizeof(PROCESSENTRY32);
if Process32First(han, ProcStruct) then
begin
repeat
sID := ExtractFileName(ProcStruct.szExeFile);
// Check only against the portion of the name supplied, ignoring case
if uppercase(copy(sId, 1, length(sName))) = uppercase(sName) then
begin
// Report we found it
Result := true;
Break;
end;
until not Process32Next(han, ProcStruct);
end;
// clean-up
CloseHandle(han);
end;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.016 c
1-98548
Term
2003-10-20 15:25
2003.10.30
Странное поведение TTreeView........


1-98656
Dimedrol
2003-10-17 10:43
2003.10.30
Как скопировать в буфер Unicod-овскую строку ?


3-98464
Broot
2003-10-11 06:29
2003.10.30
Русский язык в базе данных DBASE


3-98473
Лана Розанова
2003-10-09 22:27
2003.10.30
Фильтрация


1-98613
COSINUS
2003-10-17 18:19
2003.10.30
Прикручивание ехе-шника к электронному ключу




   Наверх