(For Windows Only)I was need to, and find solution. You can get other informations that i wrote below, from tlhelp32.h
It prints info about running process, not services!
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
typedef struct tagPROCESSENTRY32W {
DWORD dwSize;
DWORD cntUsage;
DWORD th32ProcessID;
DWORD th32DefaultHeapID;
DWORD th32ModuleID;
DWORD cntThreads;
DWORD th32ParentProcessID;
LONG pcPriClassBase;
DWORD dwFlags;
WCHAR szExeFile[MAX_PATH];
} PROCESSENTRY32W,*PPROCESSENTRY32W,*LPPROCESSENTRY32W;
typedef struct tagPROCESSENTRY32W {
DWORD dwSize;
DWORD cntUsage;
DWORD th32ProcessID;
DWORD th32DefaultHeapID;
DWORD th32ModuleID;
DWORD cntThreads;
DWORD th32ParentProcessID;
LONG pcPriClassBase;
DWORD dwFlags;
WCHAR szExeFile[MAX_PATH];
} PROCESSENTRY32W,*PPROCESSENTRY32W,*LPPROCESSENTRY32W;
To copy to clipboard, switch view to plain text mode
//in header
#include <tlhelp32.h>
#include <stdio.h>
//in Qt source
void MainWindow::getProcList()
{
BOOL bResult;
PROCESSENTRY32 processInfo = {sizeof(PROCESSENTRY32)};
HANDLE hSnapShot;
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
bResult = Process32First(hSnapShot, &processInfo);
while(bResult) {
wprintf(L"Name: %s - SysProcId: %d \n", processInfo.szExeFile,processInfo.th32ProcessID);
bResult = Process32Next(hSnapShot, &processInfo);
}
CloseHandle(hSnapShot);
}
//in header
#include <tlhelp32.h>
#include <stdio.h>
//in Qt source
void MainWindow::getProcList()
{
BOOL bResult;
PROCESSENTRY32 processInfo = {sizeof(PROCESSENTRY32)};
HANDLE hSnapShot;
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
bResult = Process32First(hSnapShot, &processInfo);
while(bResult) {
wprintf(L"Name: %s - SysProcId: %d \n", processInfo.szExeFile,processInfo.th32ProcessID);
bResult = Process32Next(hSnapShot, &processInfo);
}
CloseHandle(hSnapShot);
}
To copy to clipboard, switch view to plain text mode
Best Regards.
Bookmarks