Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void SetConsoleAlpha(byte alpha)
- {
- IntPtr hwnd = GetConsoleWindow();
- SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
- SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA);
- }
- [DllImport("kernel32.dll")]
- static extern IntPtr GetConsoleWindow();
- [DllImport("user32.dll")]
- static extern int SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong);
- [DllImport("user32.dll")]
- static extern int GetWindowLong(IntPtr hwnd, int nIndex);
- [DllImport("user32.dll")]
- static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);
- const int GWL_EXSTYLE = -20;
- const int WS_EX_LAYERED = 0x80000;
- const int LWA_ALPHA = 0x2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement