Taskbar Killer + Workarea resizer script
Feb 1, 2020 8:04:08 GMT -8
Post by sarah on Feb 1, 2020 8:04:08 GMT -8
I've been messing around with some WinAPI functions and I recently discovered that Explorer is very stubborn when it comes to other processes modifying either the taskbar or the workarea. I have also discovered, however, that the taskbar can be given a "hide" call and will cease to do almost anything. A side effect of the taskbar being hidden is that Alt+Tab no longer functions, although, interestingly, Win+Tab and the start menu do continue to work. I have made a small C program that will hide the taskbar and optionally resize the workarea to the whole screen. It should compile in any NT-based C/C++ compiler, although I personally recommend the Tiny C Compiler as it is small, free and can run C programs like scripts at runtime with JIT compilation. I hope this is useful to some of you.
NOTE: If any of the mods deem this unsafe or in the wrong category, feel free to DM me and I'll take it down.
EDIT: To clarify, this does not kill explorer. It continues running, leaving your desktop icons and background intact.
traykiller.c
/* taskbar killer - (c) sarah 2020
* LEGAL: i am not responsible if you manage to damage
* your computer using this program
*
* NOTE: i recommend using TCC as it's small and fast, but this
* should work on any NT-compatible C/C++ compiler
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
/* if you want to pre-define a workarea rect, comment out
* or remove lines 28-31 and put your preferred rect in here */
RECT screenRect = {0, 0, 1920, 1080};
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
/* get the handle to the taskbar */
HWND taskbarHandle = FindWindowA("Shell_TrayWnd", NULL);
if(!taskbarHandle) {
puts("Taskbar window not found! Is explorer running\?");
exit(1);
}
/* the function is called ShowWindow but it can hide windows too */
ShowWindow(taskbarHandle, 0);
/* get the size of the full screen */
screenRect.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
screenRect.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
screenRect.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
screenRect.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
/* after the taskbar is gone, we can modify the workarea size
* without the taskbar stomping it
* NOTE: if you only want to kill the taskbar but not modify the
* workarea size, comment out or remove this line */
SystemParametersInfo(SPI_SETWORKAREA, 0, &screenRect, 0);
return 0;
}