public void ToWallerpaperWindow_Click() { if (!IsHasProcessExits()) { //最大化启动的程序 User32Window.ShowWindow(SelectWindow.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); User32Window.SetParent(SelectWindow.Handle, workerw); int p1 = User32.GetWindowLong(SelectWindow.Handle, (int)WindowLongFlags.GWL_STYLE); p1 &= ~13500416; User32.SetWindowLong(SelectWindow.Handle, (int)WindowLongFlags.GWL_STYLE, p1); User32Window.MoveWindow(SelectWindow.Handle, 0, 0, Screen.AllScreens[0].WorkingArea.Width, Screen.AllScreens[0].WorkingArea.Height, false); User32.SetActiveWindow(SelectWindow.Handle); } }
public void SetParentWindow(IntPtr source, IntPtr dest) { User32Window.SetParent(source, dest); //User32Window.SetWindowLong(source, (int)WindowLongParam.GWL_HWNDPARENT, (int)dest); }