FAQ - C++ Builder (VCL/CLX) :: System - Aktive Prozesse auslesen :: 2



  • Hallo,

    hier eine Alternative zum Auslesen der aktiven Prozesse:

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      HANDLE hSnapshot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
      PROCESSENTRY32 pe;
      pe.dwSize=sizeof(pe);
      ListBox1->Clear();
      if(Process32First(hSnapshot, &pe))
      {
        do
        {
          ListBox1->Items->Add(pe.szExeFile);
        }while(Process32Next(hSnapshot, &pe));
      }
      CloseHandle(hSnapshot);
    }
    

    Nicht vergessen:

    #include <tlhelp32.h>
    

    MfG
    -yanix


Anmelden zum Antworten