Mega Code Archive

 
Categories / Delphi / System
 

Get list of the win32 processes

Title: Get list of the win32 processes Use CreateToolHelp32SnapShot function with TH32CS_SNAPPROCESS parameter for getting snapshot of Win32 processes. And use Process32First and Process32Next for getting information about these processes. Don't forget to add TLHelp32 to the uses chapter. uses TLHelp32; ... procedure TForm1.Button1Click(Sender: TObject); var MyHandle: THandle; Struct: TProcessEntry32; begin MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0); Struct.dwSize:=Sizeof(TProcessEntry32); if Process32First(MyHandle, Struct) then Memo1.Lines.Add(Struct.szExeFile); while Process32Next(MyHandle, Struct) do Memo1.Lines.Add(Struct.szExeFile); end;