Hello,
The following code demonstrates how to disable the "End task" button while trying to end a task in Windows 7 using the taskmanager, improvements could be made and this is not a viable approach in Windows 10 since there is no confirmation dialog. You could however do something else, I might post something about it later on.
In the meantime, enjoy and happy coding.

The following code demonstrates how to disable the "End task" button while trying to end a task in Windows 7 using the taskmanager, improvements could be made and this is not a viable approach in Windows 10 since there is no confirmation dialog. You could however do something else, I might post something about it later on.
In the meantime, enjoy and happy coding.


Source code
c
#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <stdio.h>
BOOL CALLBACK EnumChildWindowsProc(HWND hwnd, LPARAM lParam)
{
char szBuf[255];
GetWindowText(hwnd, (LPSTR)szBuf, sizeof(szBuf) - 1);
if (_stricmp(szBuf, "End Process") == 0){
SetWindowText(hwnd, "Not allowed");
EnableWindow(hwnd, FALSE);
return FALSE;
}
return TRUE;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, long lParam)
{
char szBuf[255];
if (IsWindowVisible(hwnd)){
GetWindowText(hwnd, (LPSTR)szBuf, sizeof(szBuf) - 1);
if (_stricmp(szBuf, "Windows Task Manager") == 0){
EnumChildWindows(hwnd, EnumChildWindowsProc, lParam);
}
}
return TRUE;
}
int main()
{
EnumWindows(EnumWindowsProc, 0);
return 0;
}
Bright the hawk's flight on the empty sky