public static bool Set(SetOptions op) { //Attempt to grab any window that matches IntPtr wndHandle = WindowUtils.FindWindowByTitle(op.windowName); if (wndHandle == IntPtr.Zero) { wndHandle = WindowUtils.FindWindowByClass(op.className); } //Fail early if we didn't find anything if (wndHandle == IntPtr.Zero) { Console.Error.WriteLine("Failed to find matching window."); return(false); } int x = 0, y = 0, w = 0, h = 0; parseBounds(op.bounds, out x, out y, out w, out h); //Set the wallpaper bool succesful = new WallpaperManager().SetWallpaper(wndHandle, x, y, w, h); if (!succesful) { Console.Error.WriteLine("Failed to set wallpaper"); } return(succesful); }