Autor Beitrag
Matthieu
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 41

Win XP, Win Vista
Turbo Delphi
BeitragVerfasst: Fr 25.05.07 23:00 
Wie kann ich die ausgeführten Prozesse in Delphi laden??`

Danke im voraus.
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Sa 26.05.07 06:35 
mit der froum suche :)

oder mit dem hier

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
uses
  TlHelp32




function GetProcessList(const aProcessList: TStrings);
var
  Snap: THandle;
  ProcessE: TProcessEntry32;
begin
  aProcessList.Clear;
  Snap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  try
    ProcessE.dwSize := SizeOf(ProcessE);
    if Process32First(Snap, ProcessE) then
      Repeat
        aProcessList.Add(ProcessE.szExeFile);
      Until not Process32Next(Snap, ProcessE)
    else
      RaiseLastOSError;
  finally
    CloseHandle(Snap);
  end;
end;
Matthieu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 41

Win XP, Win Vista
Turbo Delphi
BeitragVerfasst: Sa 26.05.07 07:27 
Ich versteh nur nicht ganz, wo da die Prozesse rauskommen (ich wollte eigentlich nur neu ausgeführte Prozesse erkennen und denen dann ein Datum verpassen).
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Sa 26.05.07 11:01 
user profile iconSauger Chris hat folgendes geschrieben:
mit der froum suche :)

oder mit dem hier

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
uses
  TlHelp32




function GetProcessList(const aProcessList: TStrings);
var
  Snap: THandle;
  ProcessE: TProcessEntry32;
begin
  aProcessList.Clear;
  Snap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  try
    ProcessE.dwSize := SizeOf(ProcessE);
    if Process32First(Snap, ProcessE) then
      Repeat
        aProcessList.Add(ProcessE.szExeFile);
      Until not Process32Next(Snap, ProcessE)
    else
      RaiseLastOSError;
  finally
    CloseHandle(Snap);
  end;
end;

Eine Function ohne Rückgabewert? Seltsam, seltsam...

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 26.05.07 11:04 
Man muss sich die Prozedur nur kurz anschauen: die Prozessnamen werden in dem per Referenz übergebenen aProcessList-Parameter gespeichert.

Dass das Teil als Function deklariert ist, dürfte wohl ein Flüchtigkeitsfehler sein.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".