/// <summary> /// 设置窗口点击穿透 /// </summary> /// <param name="window"></param> public void SetWindowPenetrate(IntPtr dest) { int style = User32Window.GetWindowLongA(dest, (int)WindowLongFlags.GWL_EXSTYLE); User32Window.SetWindowLong(dest, (int)WindowLongFlags.GWL_EXSTYLE, style | (int)UnmanagedMethods.WindowStyles.WS_EX_TRANSPARENT | (int)UnmanagedMethods.WindowStyles.WS_EX_LAYERED); User32Window.SetLayeredWindowAttributes(dest, 0, 255, 0x2); //User32Window.SetLayeredWindowAttributes(dest, 0, 100, 0); }
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); } }