Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

C# Fade Console Window

Code
[DllImport("user32.dll")]
        static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

        [DllImport("user32.dll")]
        static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint crKey, byte bAlpha, uint dwFlags);

        [DllImport("user32.dll", SetLastError = true)]
        internal static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);

        [DllImport("kernel32.dll", SetLastError = true)]
        internal static extern IntPtr GetConsoleWindow();


        public const int GWL_EXSTYLE = -20;
        public const int WS_EX_LAYERED = 0x80000;
        public const int LWA_ALPHA = 0x2;
        public const int LWA_COLORKEY = 0x1;

        IntPtr MainHandle = Process.GetCurrentProcess().MainWindowHandle;
            Int32 Old = (int)GetWindowLong(MainHandle, GWL_EXSTYLE);
            Int32 AlsoOld = SetWindowLong(MainHandle, GWL_EXSTYLE, Old | WS_EX_LAYERED);
            bool result = SetLayeredWindowAttributes(MainHandle, 0, 255 / 2, LWA_ALPHA); // 50% opacity


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by zioncorpDec 28, 2018 11:13 AM 5 219 Dec 28, 2018 11:13 AM
Last Post: LouisXV
[C] by KovaskaDec 5, 2017 02:24 PM 3 182 Dec 5, 2017 02:24 PM
Last Post: Hoodie+
[Python] by Solar_FlareDec 30, 2016 04:37 PM 4 159 Dec 30, 2016 04:37 PM
Last Post: Solar_Flare