Skip to content

Instantly share code, notes, and snippets.

@SonoSooS
Created June 9, 2018 20:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SonoSooS/d0b85dc69e169aa43a5081b66dda8f39 to your computer and use it in GitHub Desktop.
/*
Make Discord great again!
Copyright(C) 2017-2018 Sono
All Rights Reserved
*/
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <tlhelp32.h>
#include <dwmapi.h>
#define WFLAGS \
( WS_VISIBLE\
| WS_CLIPSIBLINGS\
| WS_CAPTION\
| WS_BORDER\
| WS_MAXIMIZEBOX\
| WS_MINIMIZEBOX\
| WS_THICKFRAME\
)
#define WEXFLAGS \
( WS_EX_COMPOSITED\
)
typedef struct
{
DWORD PID;
HWND wnd;
} cbstruct;
BOOL CALLBACK enumcallback(HWND wnd, LPARAM lParam)
{
cbstruct* data = (void*)lParam;
DWORD pid = 0;
GetWindowThreadProcessId(wnd, &pid);
if(data->PID ^ pid) return TRUE;
if(GetWindow(wnd, GW_OWNER)) return TRUE;
if(!IsWindowVisible(wnd)) return TRUE;
data->wnd = wnd;
return FALSE;
}
HWND findwnd(DWORD pid)
{
cbstruct data;
data.PID = pid;
data.wnd = 0;
EnumWindows(enumcallback, (LPARAM)&data);
return data.wnd;
}
int main()
{
PROCESSENTRY32 pe;
HANDLE snapshot;
HWND wnd;
int fug = 1;
ret:
pe.dwSize = sizeof(pe);
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
wnd = (HWND)-1;
if(Process32First(snapshot, &pe))
{
while(Process32Next(snapshot, &pe))
{
if(strstr(pe.szExeFile, "Discord") == pe.szExeFile)
{
wnd = findwnd(pe.th32ProcessID);
if(wnd && GetWindowLong(wnd, GWL_STYLE) != 0x14C20000)
{
fug = 0;
printf("HWND: %08X\n", wnd);
printf(" STYLE: %08X %08X\n", GetWindowLong(wnd, GWL_STYLE), WFLAGS);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd, GWL_STYLE) & ~(WS_DISABLED) | WFLAGS);
printf("EXSTYLE: %08X %08X\n", GetWindowLong(wnd, GWL_EXSTYLE), WEXFLAGS);
SetWindowLong(wnd, GWL_EXSTYLE, GetWindowLong(wnd, GWL_EXSTYLE) | WEXFLAGS);
DWM_BLURBEHIND bl;
bl.dwFlags = 7;
bl.fEnable = TRUE;
bl.hRgnBlur = NULL;
bl.fTransitionOnMaximized = TRUE;
DwmEnableBlurBehindWindow(wnd, &bl);
int margin = -1;
MARGINS mar = {margin, margin, margin, margin};
DwmExtendFrameIntoClientArea(wnd, &mar);
SetWindowPos(wnd, 0, 0, 0, 0, 0, 0x27);
}
}
}
}
CloseHandle(snapshot);
if(fug++)
{
if(fug <3) puts("Waiting for Discord to open");
Sleep(100);
goto ret;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment