Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2003.10.30;
Скачать: [xml.tar.bz2];

Вниз

как отслеживать в 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 вся ветка

Форум: "Система";
Текущий архив: 2003.10.30;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.009 c
1-98726
AviS1982
2003-10-17 14:39
2003.10.30
Как управлять одной программой с помощью другой


1-98634
off
2003-10-17 14:37
2003.10.30
Вывод на печать?


14-98790
kaif
2003-10-13 01:32
2003.10.30
О справедливости и здравом смысле


6-98758
Gray Angel
2003-09-05 12:06
2003.10.30
Нужен код слушалки порта на локальной машине.


9-98423
ogo
2003-04-23 08:40
2003.10.30
экспорт 3d персонажей





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский