Explorer Toolbar Borders using Windhawk
Mar 29, 2023 11:27:01 GMT -8
Post by waldemar21214 on Mar 29, 2023 11:27:01 GMT -8
Hey! This is my first Windhawk mod, it's meant to be a alternative to the AHK script made by ROB.
It's missing the equal toolbar heights, though. It can be added as a Windhawk option propably. I won't do it now because I don't like it I'm on borrowed time already, my client keeps nagging to do this, that, the color is wrong, you all know what's up. Feel free to add to this should you need something. Inspired by SCT FEH.
Confirmed to work on Win10 22H2.
// ==WindhawkMod==
// @id classic-explorer-toolbars
// @name Classic Explorer Toolbars
// @description Modifies ReBarWindow32 in file explorer so as to make it look more classic.
// @version 0.2
// @author Waldemar
// @include explorer.exe
// @compilerOptions -lcomdlg32
// ==/WindhawkMod==
using ShowWindow_t = decltype(&ShowWindow);
ShowWindow_t pOriginalShowWindow;
WINBOOL WINAPI ShowWindowHook(HWND hWnd,int nCmdShow)
{
wchar_t bufr[256];
GetClassName(hWnd, bufr, 256);
if (lstrcmpW(bufr, L"CabinetWClass") == 0)
{
HWND p = hWnd;
HWND rebar = NULL;
p = FindWindowEx(p, NULL, L"ShellTabWindowClass", NULL);
if(p != NULL)
{
p = FindWindowEx(p, NULL, L"WorkerW", NULL);
if(p != NULL)
{
p = FindWindowEx(p, NULL, L"ReBarWindow32", NULL);
if(p != NULL)
{
rebar = p;
}
}
}
if(rebar != NULL)
{
SetWindowLongPtrW(rebar, GWL_STYLE, GetWindowLongPtrW(rebar, GWL_STYLE) | 0x00800400); //Sets the style to include WS_BORDER | RBS_BANDBORDERS
RECT rect;
GetWindowRect(rebar, &rect);
SetWindowPos(rebar, NULL, NULL, NULL, rect.right - rect.left + 1, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_DEFERERASE);
SetWindowPos(rebar, NULL, NULL, NULL, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_DEFERERASE);
}
}
return pOriginalShowWindow(hWnd, nCmdShow);
}
BOOL Wh_ModInit() {
Wh_SetFunctionHook((void*)ShowWindow, (void*)ShowWindowHook, (void**)&pOriginalShowWindow);
return TRUE;
}