Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Läuft ein bestimmtes Programm? (https://www.delphipraxis.net/10861-laeuft-ein-bestimmtes-programm.html)

Wheelie 26. Okt 2003 22:23


Läuft ein bestimmtes Programm?
 
wie kann ich unter windows2000/xp checken, ob eine bestimmtes programme läuft (*.exe)???
hatte sowas schonmal, läuft aber nur unter win98/me... :cry:

gruß

lukas

Uncle Cracker 26. Okt 2003 22:25

Re: Läuft ein bestimmtes Programm?
 
Vielleicht hilft dir das hier

Delphi-Quellcode:
function EnumWinProc(Wnd: hWnd): Boolean; StdCall;
 var
  WinCaption : Pchar;
  WinHandle : string;
 begin
   GetMem(WinCaption, 255);
   try
     GetWindowText(Wnd, WinCaption, 255);
     Result := True;
     if (Trim(WinCaption) <> '') then
     begin
       WinHandle := IntToHex(Wnd, 6);
       Form1.ListBox1.Items.add(WinHandle + ' : ' + WinCaption);
     end;
   finally
    FreeMem(WinCaption, 255);
   end;
 end;
Jedoch werden alle Prozesse in eine Listbox eingtragen, doch du willst nur nach einem bestimmt EXE-Namen suchen, oder?

[Edit]Aufgerufen wird so:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  EnumWindows(@EnumWinProc, Application.Handle);
end;

Wheelie 26. Okt 2003 22:47

Re: Läuft ein bestimmtes Programm?
 
ne ist nicht ganz das richtige...habe einen programm-pfad (C:\...\prog.exe) und will nun rausfinden ob dieses programm ausgeführt wird oder nicht...danke trotzdem für die schnelle antwort (komme übrigens auch aus dresden :-D )

Wheelie 26. Okt 2003 23:09

Re: Läuft ein bestimmtes Programm?
 
@alle profis: ihr wisst doch bestimmt wie das geht oder? habe in der suche was gefunden, brauche dazu aber die psApi...hat denn sonst keiner nen vorschlag?

Luckie 27. Okt 2003 00:56

Re: Läuft ein bestimmtes Programm?
 
@Uncle Cracker: das listet alle Fenster auf. Nur gilt: Fenster <> Prozess!!

Suich mal hier nach Hier im Forum suchenCreateToolHelp32SnapShot ins besondere in der Code Library, dass sollte dir helfen.

fxbasic 16. Feb 2004 10:45

Re: Läuft ein bestimmtes Programm?
 
Moin, in dem Moment wo ich die Funktion

Delphi-Quellcode:
EnumWindows(@EnumWinProc, Application.Handle);
aufrufe und dann mit der Listbox weiterarbeiten will (For-Schleife), stürzt mir das Programm mit "Fehler bei read" im Laufzeitmodus ab.

Was läuft da schief???

Gruß, fxbasic

Luckie 16. Feb 2004 14:55

Re: Läuft ein bestimmtes Programm?
 
Was verstehst du unter "weiter arbeiten"? Wie wäre es mit etwas Code?

franz 28. Feb 2004 23:51

Re: Läuft ein bestimmtes Programm?
 
Hi,

sieh dir das mal an:

Testen ob eine Datei benutzt wird


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:16 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz