Skip to content

Instantly share code, notes, and snippets.

@ioncodes
Created September 21, 2016 15:26
Show Gist options
  • Save ioncodes/fb677ed4f8cf9fa7fd5749c6c948dc6e to your computer and use it in GitHub Desktop.
Save ioncodes/fb677ed4f8cf9fa7fd5749c6c948dc6e to your computer and use it in GitHub Desktop.
Header to set the transparency of your console.
#include <Windows.h>
inline BOOL WindowTransparency(HWND hwnd, BYTE bAlpha)
{
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwnd, RGB(255, 255, 255), bAlpha, 2);
return true;
}
inline VOID SetTransparency(int transparency)
{
HWND consoleWnd = GetConsoleWindow(); // Get the handle
WindowTransparency(consoleWnd, transparency); // Set the transparency
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment