Skip to content

Instantly share code, notes, and snippets.

@ethanhs
Last active December 16, 2022 02:00
Show Gist options
  • Star 56 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save ethanhs/0e157e4003812e99bf5bc7cb6f73459f to your computer and use it in GitHub Desktop.
Save ethanhs/0e157e4003812e99bf5bc7cb6f73459f to your computer and use it in GitHub Desktop.
#include <windows.h>
void SetWindowBlur(HWND hWnd)
{
const HINSTANCE hModule = LoadLibrary(TEXT("user32.dll"));
if (hModule)
{
struct ACCENTPOLICY
{
int nAccentState;
int nFlags;
int nColor;
int nAnimationId;
};
struct WINCOMPATTRDATA
{
int nAttribute;
PVOID pData;
ULONG ulDataSize;
};
typedef BOOL(WINAPI*pSetWindowCompositionAttribute)(HWND, WINCOMPATTRDATA*);
const pSetWindowCompositionAttribute SetWindowCompositionAttribute = (pSetWindowCompositionAttribute)GetProcAddress(hModule, "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute)
{
ACCENTPOLICY policy = { 3, 0, 0, 0 }; // ACCENT_ENABLE_BLURBEHIND=3...
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) }; // WCA_ACCENT_POLICY=19
SetWindowCompositionAttribute(hWnd, &data);
}
FreeLibrary(hModule);
}
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
HWND taskbar = FindWindow(L"Shell_TrayWnd", NULL);
while (true) {
SetWindowBlur(taskbar); Sleep((DWORD)10);
}
}
@wbalbinot
Copy link

Waiting for the v2 :D

@marklk
Copy link

marklk commented Jan 13, 2017

So just exactly how would i instal this code? Does it come in a executable version?

@ethanhs
Copy link
Author

ethanhs commented Jun 3, 2017

A lot has happened since this was published. Please see https://github.com/TranslucentTB/TranslucentTB/ for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment