Autor Beitrag
ShadowThief
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Mo 03.11.03 14:18 
hallo,

ich möchte alle geöffnete programme in einer listbox (im grunde wie
im taskmanager) anzeigen. ich habe dazu hier und bei google
nichts gefunden.

ich verwende windows 2000.

shadow.

ps: ich suche nichts bestimmtes, d. h. findwindow nützt mir hier
leider nichts.

_________________
"soylent grün ist menschenfleisch!"
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.11.03 15:21 
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 04.11.03 10:31 
ich schätze mal, du meinst enumwindows.zip, oder? da bekomm ich halt alle fenster, die offen sind. z. B. auch den delphi-objektinspektor, obwohl der in der taskleiste und im taskmanager nicht auftaucht.

was ich bräuchte wäre eine genaue liste, so wie sie im taskmanager unter "anwendungen" zu finden ist.

falls es das nicht gibt, schlag ich mich mit enumwindows durch.

danke einstweilen.

shadow.

_________________
"soylent grün ist menschenfleisch!"
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 04.11.03 10:38 
Ich meinete eigentlich CreateToolhel32Snapshot und oder EnumProcesses.
ausblenden Quelltext
1:
CreateToolhelp32Snapshot.zip             28-Sep-2003 15:26     2k  Prozesse mittels eines Snapshots auflisten. Einen Prozess beenden.					

ausblenden Quelltext
1:
EnumProcesses.zip                        28-Sep-2003 15:26     3k  Processe mittels EnumProcesses auflisten.					
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 04.11.03 11:37 
das sind dann alle prozesse, aber nicht alle anwendungen.

_________________
"soylent grün ist menschenfleisch!"
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 04.11.03 12:09 
Wie definierst du Anwendung und wie Prozess?
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 04.11.03 12:14 
anwendungen sind die dinger, die im taskmanager unter anwendungen stehn, und prozesses sind die dinger die im taskmanager unter prozesse stehn.

sorry, aber da fällt mir echt nix anderes ein.

shadow.

_________________
"soylent grün ist menschenfleisch!"
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 04.11.03 12:26 
Ein Prozess kann mehrere Fenster haben. Ein Fenster aber nur eine Prozess zu dem es gehört. Jetzt musst du die ein Kriterium einfallen lassen, nach dem du die Prozesse Filterst, damit du das bekommst, was du willst.
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 04.11.03 13:01 
das muss doch irgendwie einfacher gehn, aber ich finds echt nicht raus.

mist.
shadow.

_________________
"soylent grün ist menschenfleisch!"
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 04.11.03 14:41 
Hier mal der Sourcecode damit die anderen User nicht erst etwas suchen und das ganze downloaden müssen:
ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
uses
  tlhelp32;

{******************************************************************************}
{**                                                                          **}
{** Prozesse in Stringliste schreiben                                        **}
{**                                                                          **}
{******************************************************************************}
procedure GetProcessList(sl: TStrings);
var
  hProcSnap: THandle;
  pe32: TProcessEntry32;
begin
  { Snapshot machen *PENG* }
  hProcSnap := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  if hProcSnap = INVALID_HANDLE_VALUE then exit;

  pe32.dwSize := SizeOf(ProcessEntry32);

  { wenn es geklappt hat }
  if Process32First(hProcSnap, pe32) = true then
    { und los geht's }
    { Process32First liefert auch schon einen Prozess, den System-Prozess }
    sl.Add(pe32.szExeFile);
    while Process32Next(hProcSnap, pe32) = true do
    begin
      sl.Add(pe32.szExeFile);
    end;
  CloseHandle(hProcSnap);
end;

{******************************************************************************}
{**                                                                          **}
{** ProzessID an Hand der Exe-Datei ermittlen                                **}
{**                                                                          **}
{******************************************************************************}
function GetProcessID(sProcName: String): Integer;
var
  hProcSnap: THandle;
  pe32: TProcessEntry32;
begin
  result := -1;
  hProcSnap := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  if hProcSnap = INVALID_HANDLE_VALUE then exit;

  pe32.dwSize := SizeOf(ProcessEntry32);

  { wenn es geklappt hat }
  if Process32First(hProcSnap, pe32) = true then
    { und los geht's: Prozess suchen}
    while Process32Next(hProcSnap, pe32) = true do
    begin
      if pos(sProcName, pe32.szExeFile) <> 0then
        result := pe32.th32ProcessID;
    end;
end;

{******************************************************************************}
{**                                                                          **}
{** Prozess beenden                                                          **}
{**                                                                          **}
{******************************************************************************}
procedure KillProcess(dwProcID: DWORD);
var
  hProcess : Cardinal;
  dw       : DWORD;
begin
  { open the process and store the process-handle }
  hProcess := OpenProcess(SYNCHRONIZE or PROCESS_TERMINATE, False, dwProcID);
  { kill it }
  TerminateProcess(hProcess, 0);
  { TerminateProcess returns immediately, so wie have to verify the result via
    WaitForSingleObject }

  dw := WaitForSingleObject(hProcess, 5000);
  case dw of
    { everythings's all right, we killed the process }
    WAIT_OBJECT_0: Messagebox(Application.Handle, 'Prozess wurde beendet.''Prozess beenden',
      MB_ICONINFORMATION);
    { process could not be terminated after 5 seconds }
    WAIT_TIMEOUT:
    begin
      Messagebox(Application.Handle, 'Prozess konnte nicht innerhalb von 5 Sekunden beendet werden.',
        'Prozess beenden', MB_ICONSTOP);
      exit;
    end;
    { error in calling WaitForSingleObject }
    WAIT_FAILED:
    begin
      RaiseLastOSError;
      exit;
    end;
  end;
  { and refresh listbox contend }
  Form1.Button1Click(Form1);
end;

Falls etwas dagegen spricht (Luckie) bitte melden.

Gruß
Tino
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 04.11.03 17:48 
ähm ... das sind jetzt wieder die prozesse.

_________________
"soylent grün ist menschenfleisch!"