Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Add fixstrips.wh.cpp
  • Loading branch information
Olive6841 authored Sep 10, 2024
1 parent 89b7248 commit 819c716
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions fixstrips.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ==WindhawkMod==

Check warning on line 1 in fixstrips.wh.cpp

View workflow job for this annotation

GitHub Actions / Test changed files

File is not placed in the mods folder
// @id fix-strips

Check warning on line 2 in fixstrips.wh.cpp

View workflow job for this annotation

GitHub Actions / Test changed files

Expected the id to be "fixstrips"
// @name FixStrips WH Port
// @description Port of the fixstrips AHK script that fixes some classic theme issues with Explorer7
// @version 1.0
// @author OliveIsTyping + Anixx for the original script
// @github https://github.com/OliviaIsTyping
// @include explorer.exe
// @compilerOptions -lcomdlg32
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
## NOTE:
You might need to restart explorer for changes to take affect
*/
// ==/WindhawkModReadme==

// ==WindhawkModSettings==

// ==/WindhawkModSettings==
#include <windows.h>

using CreateWindowExW_t = decltype(&CreateWindowExW);
CreateWindowExW_t CreateWindowExW_Orig;
HWND WINAPI CreateWindowExW_Hook(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,
HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam) {

wchar_t wszClassName[200];
ZeroMemory(wszClassName, 200);
//Add WS_DLGFRAME to Shell_TrayWnd
if ((((ULONG_PTR)lpClassName & ~(ULONG_PTR)0xffff) != 0) && !wcscmp(lpClassName, L"Shell_TrayWnd"))
{
dwStyle |= WS_DLGFRAME;
}
HWND hWnd = CreateWindowExW_Orig(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam);

//Remove WS_DLGFRAME from Shell_TrayWnd (dont ask why it works but it does :D)
if ((((ULONG_PTR)lpClassName & ~(ULONG_PTR)0xffff) != 0) && !wcscmp(lpClassName, L"Shell_TrayWnd"))
{
SetWindowLongPtrW(hWnd,GWL_STYLE,GetWindowLongPtrW(hWnd, GWL_STYLE) & ~WS_DLGFRAME);
}

return hWnd;
}


// The mod is being initialized, load settings, hook functions, and do other initialization stuff if required.
BOOL Wh_ModInit() {
Wh_Log(L"Init");

Wh_SetFunctionHook((void*)CreateWindowExW,
(void*)CreateWindowExW_Hook,
(void**)&CreateWindowExW_Orig);
return TRUE;
}

// The mod is being unloaded, free all allocated resources.
void Wh_ModUninit() {
Wh_Log(L"Uninit");
}

0 comments on commit 819c716

Please sign in to comment.