Örnek kaynak atarmisin dostumHayır o şekilde olmaz ancak cpu ve mem kullanım oranına göre alabilirsin asıl exenin değerleri diğerine göre daha fazla
int GetProcessThreadNumByID(DWORD dwPID)
{
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
return 0;
PROCESSENTRY32 pe32 = { 0 };
pe32.dwSize = sizeof(pe32);
BOOL bRet = ::Process32First(hProcessSnap, &pe32);;
while (bRet)
{
if (pe32.th32ProcessID == dwPID)
{
::CloseHandle(hProcessSnap);
return pe32.cntThreads;
}
bRet = ::Process32Next(hProcessSnap, &pe32);
}
return 0;
}
int GetAowId()
{
DWORD dwRet = 0;
DWORD dwThreadCountMax = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hSnapshot, &pe32);
do
{
if (_tcsicmp(pe32.szExeFile, _T("aow_exe.exe")) == 0)
{
DWORD dwTmpThreadCount = GetProcessThreadNumByID(pe32.th32ProcessID);
if (dwTmpThreadCount > dwThreadCountMax)
{
dwThreadCountMax = dwTmpThreadCount;
dwRet = pe32.th32ProcessID;
}
}
} while (Process32Next(hSnapshot, &pe32));
CloseHandle(hSnapshot);
return dwRet;
}
Sen nasil bir kralsin <3Doğru adresi int olarak verecektirC++:int GetAowId() { DWORD dwRet = 0; DWORD dwThreadCountMax = 0; HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); PROCESSENTRY32 pe32; pe32.dwSize = sizeof(PROCESSENTRY32); Process32First(hSnapshot, &pe32); do { if (_tcsicmp(pe32.szExeFile, _T("aow_exe.exe")) == 0) { DWORD dwTmpThreadCount = GetProcessThreadNumByID(pe32.th32ProcessID); if (dwTmpThreadCount > dwThreadCountMax) { dwThreadCountMax = dwTmpThreadCount; dwRet = pe32.th32ProcessID; } } } while (Process32Next(hSnapshot, &pe32)); CloseHandle(hSnapshot); return dwRet; }
bu kod tanimli degil hatasi veriyorGetProcessThreadNumByID
PROCESS_MEMORY_COUNTERS ProcMC;
PROCESSENTRY32 ProcEntry;
ProcEntry.dwSize = sizeof(PROCESSENTRY32);
HANDLE ProcHandle;
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (Process32First(snapshot, &ProcEntry) == TRUE)
{
while (Process32Next(snapshot, &ProcEntry) == TRUE)
{
if (_wcsicmp(ProcEntry.szExeFile, L"aow_exe.exe") == 0)
{
ProcHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ProcEntry.th32ProcessID);
if (NULL == ProcHandle)
continue;
if (GetProcessMemoryInfo(ProcHandle, &ProcMC, sizeof(ProcMC)))
{
if (ProcMC.WorkingSetSize > 300000000)
{
break;
}
}
CloseHandle(ProcHandle);
}
}
}
CloseHandle(snapshot);
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?