I need someone to give me the code for the following program that could run in linux. The following code is for windows and can be run easily through devc++. I know its not right to ask but at the moment I need it more then anything. Please send me the code over here : k112035@nu.edu.pk THANKS
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // We will take a snapshot
if (hProcessSnap != INVALID_HANDLE_VALUE)
{
pe32.dwSize = sizeof(PROCESSENTRY32);
cout<<pe32.th32ProcessID; // Process ID
Gotoxy(65,8+i);
SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
cout<<pe32.th32ParentProcessID;
i++;
} while (Process32Next(hProcessSnap, &pe32)); // we take all processes
SetConsoleTextAttribute(handle, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
}
}
Gotoxy(10,10+i);
SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
cout<<"Enter Process ID to Kill Process : ";
SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY );
cin>>pID; // Process ID to kill
hProcess = OpenProcess(PROCESS_TERMINATE, 0, pID); // Open process First
TerminateProcess(hProcess,0); // Kils the process
CloseHandle(hProcess); // closing the handler
main();
return EXIT_SUCCESS;