tommy
Newbie

Offline
Beiträge: 35

|
 |
« Antworten #1 am: 08.01.2003, 14:57:28 » |
|
HI!
ich habe mal eine kleines testprog geschrieben anhand der rückgabe kannst du das programm suchen
Wichtig ist hier die Unit (psapi)
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,psapi;
type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private-Deklarationen } function leseprozessewinnt:String; public { Public-Deklarationen } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin memo1.Text := leseprozessewinnt; end;
function TForm1.leseprozessewinnt:String; var i2 : Integer; proccount : Integer; procid : Dword; ModuleName : array [0..300] of char ; PIDArray : array [0..1023] of DWORD ; hMod : HMODULE; cb : DWORD; begin result := ''; EnumProcesses(@PIDArray, sizeof(PIDArray), cb); ProcCount := cb div sizeof(DWORD); for i2:=1 to proccount-1 do begin; // PROZESS ÖFFNEN procid := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, false, PIDArray[i2]); if(procid <> 0) then begin; EnumProcessModules(procid, @hMod, sizeof(hMod), cb); GetModuleFilenameEx(procid,hMod,modulename,sizeof(ModuleName)); // NAME UND PID SICHERN result := result + 'Name: ('+modulename + ' - PID ('+inttostr(PIDArray[i2])+')'+chr(13)+chr(10); end; // PROZESS SCHLIESSEN closehandle(procid); end; end;
end.
Tommy
|