All process handles are the same (CreateToolhelp32Snapshot)
<p>For some reason all window handles I retrieve are the same..</p>

<p><img src="http://i.stack.imgur.com/Mx6Jo.png" alt="handles"></p>

<p>I don't see why this is the case.</p>

<pre><code>int classname::functionname(const char* processname)
{
    PROCESSENTRY32 entry;
    entry.dwSize = sizeof(PROCESSENTRY32);

    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);

    if (Process32First(snapshot, &amp;entry) == TRUE)
    {
        while (Process32Next(snapshot, &amp;entry) == TRUE)
        {
            if (stricmp(entry.szExeFile, processname) == 0)
            {  
                HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION + PROCESS_VM_READ + PROCESS_TERMINATE, FALSE, entry.th32ProcessID);
                cout &lt;&lt; "Name: " &lt;&lt; processname &lt;&lt; " Handle: " &lt;&lt; hProcess &lt;&lt; endl;
                CloseHandle(hProcess);
            }
        }
    }

    CloseHandle(snapshot);

    return 0;
}
</code></pre>
