You can enumerate the processes using the PSAPI specifically EnumProcesses
You'll need to #include "psapi.h"
from the SDK and add PSAPI.lib
to the linker inputs.
Ex:
DWORD aiPID[1000], iCb=1000;
DWORD iCbneeded = 0;
if (!EnumProcesses(aiPID, iCb, &iCbneeded)) return(E_FAIL);
int iNumProc=iCbneeded/sizeof(DWORD);
for(int i=0; i < iNumProc; i++)
{
// First, get a handle to the process
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, aiPID[i]);
if (!hProc) continue;
TCHAR szName[MAX_PATH] = _T("<unknown>");
HINSTANCE hMod = NULL;
if (EnumProcessModules(hProc, &hMod, sizeof(hMod), &iCbneeded))
{
GetModuleFileNameEx(hProc, hMod, (LPTSTR)szName, MAX_PATH);
}
CloseHandle(hProc);
}
Edit: Sorry - That only gives you the lists of processes... to get the threads for each see ListProcessThreads passing in the PID for each enumerated process.