Home
Forums
Software
Articles
Research
Codebin
About
Logotype
Win7 disable end task, taskmanager
Started by Anasazi, 2020-02-24 23:33:55
Total posts: 2
Page: 1 of 1Prev pageNext page
Anasazi
Posted 2020-02-24 23:33:55
Avatar
Violent Saint
Administrator
17 posts
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. :happy:

usrPic

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
#1
Prepstorm
Posted 2020-03-02 18:50:59
Avatar
Moderator
15 posts
Specialist
Nice code!

#2
Total posts: 2
Page: 1 of 1Prev pageNext page