while(1){
HANDLE hProcessSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
HANDLE hProcessSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
You are trying to redefine the same variable. Remove the type (
HANDLE
) from the second occurrence. Or if you want two such handles then rename one of them.