Пример #1
0
 private static void SetWindowData(this IntPtr window, WindowData data, Func <WindowStyles, WindowStyles> transform)
 {
     PInvoke.SetWindowLong(window, (int)data, (uint)transform((WindowStyles)PInvoke.GetWindowLong(window, (int)data)));
 }
Пример #2
0
        private static void Main(string[] args)
        {
            /* Si, ya sé... esto NO es SOLID en lo absoluto */

            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                Console.WriteLine(@"Este demo únicamente funciona en Microsoft Windows...    ¯\_(ツ)_/¯ ");
                Console.WriteLine("Here's an atomic explosion instead:");
                Console.WriteLine(@"
  _.----._
 (   (    )
(  (    )  )
 (________)
    ||||
  --++++--
    ||||
  .(    ).
 (_(____)_)");
                return;
            }
            var cw = PInvoke.GetConsoleWindow();

            if (cw == IntPtr.Zero)
            {
                Console.WriteLine("Neles. No se pudo obtener la consola.");
                return;
            }

            var nfc = false;

            if (args.Contains("transparent"))
            {
                cw.MakeTransparent();
                Console.WriteLine("Ventana transparente");
            }
            if (args.Contains("blur"))
            {
                cw.EnableBlur();
                Console.WriteLine("Blur habilitado");
            }
            if (args.Contains("acrylic"))
            {
                cw.EnableAcrylic();
                Console.Write("Acrílico habilitado");
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("( /!\\ BOGUS!!!)");
                Console.ResetColor();
            }
            if (args.Contains("noclose"))
            {
                nfc = true;
                cw.HideClose();
                Console.WriteLine("Sin botón de cerrar");
            }
            if (args.Contains("nomax"))
            {
                nfc = true;
                cw.HideMaximize();
                Console.WriteLine("Sin botón de maximizar");
            }
            if (args.Contains("nomin"))
            {
                nfc = true;
                cw.HideMinimize();
                Console.WriteLine("Sin botón de minimizar");
            }
            if (args.Contains("nocaption"))
            {
                nfc = true;
                cw.HideCaption();
                Console.WriteLine("Sin caption");
            }
            if (args.Contains("noborder"))
            {
                nfc = true;
                cw.HideBorder();
                Console.WriteLine("Sin borde");
            }

            if (nfc)
            {
                cw.NotifyWindowFrameChange();
            }
            Console.ReadLine();
        }
Пример #3
0
 public static bool IsCompositionEnabled()
 {
     return(PInvoke.DwmIsCompositionEnabled());
 }