Einzelnen Beitrag anzeigen

NicoDE
(Gast)

n/a Beiträge
 
#3

Re: Liste aller Threads einer Application

  Alt 26. Apr 2005, 12:12
Delphi-Quellcode:
uses
  TlHelp32;

var
  Snapshot: THandle;
  Thread32: TThreadEntry32;
begin
  Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId());
  if (Snapshot <> 0) and (Snapshot <> INVALID_HANDLE_VALUE) then
    try
      ZeroMemory(&Thread32, SizeOf(TThreadEntry32));
      Thread32.dwSize := SizeOf(TThreadEntry32);
      if Thread32First(Snapshot, Thread32) then
        repeat
          //...
        until not Thread32Next(Snapshot, Thread32);
    finally
      CloseHandle(Snapshot);
    end;
end;
  Mit Zitat antworten Zitat