Autor Beitrag
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 15.02.09 13:07 
Hallo,

Ich möchte in freepascal herausfinden, ob ein bestimmter Prozess gerade läuft. Ich habe einige Codes dazu gefunden, allerdings scheint freepascal selbst enumprocesses() nicht zu kennen. Gibt es Alternativen oder muss ich nur eine spezielle unit einbinden? (windows ist eingebunden)

Vielen Dank,

mfg
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19274
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 15.02.09 16:29 
In Delphi ist das die Unit PsApi.
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 15.02.09 20:20 
Die kennt fpc leider nicht :(
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19274
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 15.02.09 20:27 
Dann kannst du die Methode ja selbst deklarieren, entweder dynamisch wie in den JEDI API-Übersetzungen oder fest mit external.

Die entsprechende Datei der JEDIs siehst du hier:
vvv.truls.org/pascal/UNITS.W32/Psapi.pas
Die kompletten Übersetzungen findest du hier:
jedi-apilib.sourceforge.net/
F34r0fTh3D4rk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mo 16.02.09 14:44 
Danke, hiermit gehts:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
const
  Psapi = 'PSAPI.dll';

function EnumProcesses(lpidProcess: LPDWORD; cb: DWORD; var cbNeeded: DWORD): BOOL; stdcallexternal Psapi name 'EnumProcesses';
function EnumProcessModules(hProcess: THandle; lphModule: LPDWORD; cb: DWORD; var lpcbNeeded: DWORD): BOOL; stdcallexternal Psapi name 'EnumProcessModules';
function GetModuleFileNameEx(hProcess: THandle; hModule: HMODULE; lpFilename: PChar; nSize: DWORD): DWORD; stdcallexternal Psapi name 'GetModuleFileNameExA';
:D

mfg