public void HideWindow(NativeWindowModel window)
 {
     if (!window.IsHasProcessExits())
     {
         User32Window.ShowWindow(window.Handle, (short)User32Window.Cmd_SHOWWINDOWS.SW_HIDE);
     }
 }
 public static void Kill(this NativeWindowModel window)
 {
     if (!window.IsHasProcessExits())
     {
         window.Process?.Kill();
     }
 }
 public void MaximizeWindow(NativeWindowModel window)
 {
     if (!window.IsHasProcessExits())
     {
         //最大化启动的程序
         User32Window.ShowWindow(window.Handle, (short)User32Window.Cmd_SHOWWINDOWS.SW_MAXIMIZE);
     }
 }
 public void NormalWindow(NativeWindowModel window)
 {
     if (!window.IsHasProcessExits())
     {
         User32Window.ShowWindow(window.Handle, (short)User32Window.Cmd_SHOWWINDOWS.SW_RESTORE);
         int p1 = User32Window.GetWindowLongA(window.Handle, (int)WindowLongFlags.GWL_STYLE);
         User32Window.SetWindowLong(window.Handle, (int)WindowLongFlags.GWL_STYLE, p1);
     }
 }
 /// <summary>
 /// 将传入窗口设置为无边框窗口化
 /// </summary>
 /// <param name="window"></param>
 public void BorderlessWindow(NativeWindowModel window)
 {
     if (!window.IsHasProcessExits())
     {
         int p1 = User32Window.GetWindowLongA(window.Handle, (int)WindowLongFlags.GWL_STYLE);
         p1 &= ~13500416;
         User32Window.SetWindowLong(window.Handle, (int)WindowLongFlags.GWL_STYLE, p1);
     }
 }
        public void ToWallerpaperWindow(NativeWindowModel window)
        {
            if (!window.IsHasProcessExits())
            {
                //最大化启动的程序
                User32Window.ShowWindow(window.Handle, (short)User32Window.Cmd_SHOWWINDOWS.SW_RESTORE);
                IntPtr progman = User32Window.FindWindow("Progman", null);
                IntPtr result  = User32Window.SendMessage(progman, 0x052C, new IntPtr(0), IntPtr.Zero);
                IntPtr workerw = IntPtr.Zero;

                User32Window.EnumWindows(((tophandle, topparamhandle) =>
                {
                    IntPtr p = User32Window.FindWindowEx(tophandle,
                                                         IntPtr.Zero,
                                                         "SHELLDLL_DefView",
                                                         null);

                    if (p != IntPtr.Zero)
                    {
                        workerw = User32Window.FindWindowEx(IntPtr.Zero,
                                                            tophandle,
                                                            "WorkerW",
                                                            null);
                    }
                    return(true);
                }), IntPtr.Zero);
                SetParentWindow(window.Handle, workerw);


                int p1 = User32Window.GetWindowLongA(window.Handle, (int)WindowLongFlags.GWL_STYLE);
                p1 &= ~13500416;
                User32Window.SetWindowLong(window.Handle, (int)WindowLongFlags.GWL_STYLE, p1);

                //最大化启动的程序
                User32Window.ShowWindow(window.Handle, (short)User32Window.Cmd_SHOWWINDOWS.SW_MAXIMIZE);
                //User32Window.MoveWindow(window.Handle, 0, 0, Screen.AllScreens[0].WorkingArea.Width,
                //    Screen.AllScreens[0].WorkingArea.Height, false);

                User32Window.SetActiveWindow(window.Handle);
            }
        }