wallpaper

Change wallpaper programmatically using c++ and windows api

我的未来我决定 提交于 2021-02-05 20:37:50
问题 I've been trying to write an application, using Qt and mingw32, to download images and set them as the background Wallpaper. I have read several articles online about how to do this, in VB and C#, and to some extent how to do it in c++. I am currently calling the SystemParametersInfo with what seems to be all the correct arguments (no compiler errors) and it fails. No great crash of cymbals, just a 0 returned. GetLastError() returns an equally enlightening 0 . Below is the code I am using (In

Change wallpaper programmatically using c++ and windows api

感情迁移 提交于 2021-02-05 20:35:26
问题 I've been trying to write an application, using Qt and mingw32, to download images and set them as the background Wallpaper. I have read several articles online about how to do this, in VB and C#, and to some extent how to do it in c++. I am currently calling the SystemParametersInfo with what seems to be all the correct arguments (no compiler errors) and it fails. No great crash of cymbals, just a 0 returned. GetLastError() returns an equally enlightening 0 . Below is the code I am using (In

Setting wallpaper in Android

一世执手 提交于 2020-03-13 05:25:42
问题 I am developing a simple app that sets wallpapers based on user input. I am missing code for setting wallpapers. I have been looking for it in lots of websites in vain. Can anybody post a sample code that sets as a wallpaper as a drawable that is saved in the res folder? 回答1: Works on Android 1.5 and above public void setWallpaper() { Context context = this.getBaseContext(); Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), mImageIds[pos]); context.setWallpaper(mBitmap); } 回答2: u

Setting wallpaper in Android

扶醉桌前 提交于 2020-03-13 05:23:15
问题 I am developing a simple app that sets wallpapers based on user input. I am missing code for setting wallpapers. I have been looking for it in lots of websites in vain. Can anybody post a sample code that sets as a wallpaper as a drawable that is saved in the res folder? 回答1: Works on Android 1.5 and above public void setWallpaper() { Context context = this.getBaseContext(); Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), mImageIds[pos]); context.setWallpaper(mBitmap); } 回答2: u

C#: Set Desktop Wallpaper to a Solid Color

安稳与你 提交于 2020-01-21 12:04:06
问题 I'm using this code to remove the current wallpaper and set a solid color: public static class WallpaperColorChanger { public static void SetColor(Color color) { // Remove the current wallpaper NativeMethods.SystemParametersInfo( NativeMethods.SPI_SETDESKWALLPAPER, 0, "", NativeMethods.SPIF_UPDATEINIFILE | NativeMethods.SPIF_SENDWININICHANGE); // Set the new desktop solid color for the current session int[] elements = { NativeMethods.COLOR_DESKTOP }; int[] colors = { System.Drawing

C#: Set Desktop Wallpaper to a Solid Color

混江龙づ霸主 提交于 2020-01-21 12:02:41
问题 I'm using this code to remove the current wallpaper and set a solid color: public static class WallpaperColorChanger { public static void SetColor(Color color) { // Remove the current wallpaper NativeMethods.SystemParametersInfo( NativeMethods.SPI_SETDESKWALLPAPER, 0, "", NativeMethods.SPIF_UPDATEINIFILE | NativeMethods.SPIF_SENDWININICHANGE); // Set the new desktop solid color for the current session int[] elements = { NativeMethods.COLOR_DESKTOP }; int[] colors = { System.Drawing

onHandleIntent() - Wallpaper change not working correctly

风格不统一 提交于 2020-01-06 10:18:14
问题 I am using the IntentService to change wallpaper in the background. Using the code below inside the main Activity class the wallpaper changes to an image correctly, but when the code is added to the onHandleItent() the background changes to a different solid color each time. Is this a memory issue or what? Code inside Activity class - works correctly: public void ChangeWallpaper(String imagepath) { DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay()

onHandleIntent() - Wallpaper change not working correctly

你。 提交于 2020-01-06 10:17:54
问题 I am using the IntentService to change wallpaper in the background. Using the code below inside the main Activity class the wallpaper changes to an image correctly, but when the code is added to the onHandleItent() the background changes to a different solid color each time. Is this a memory issue or what? Code inside Activity class - works correctly: public void ChangeWallpaper(String imagepath) { DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay()

onHandleIntent() - Wallpaper change not working correctly

笑着哭i 提交于 2020-01-06 10:17:06
问题 I am using the IntentService to change wallpaper in the background. Using the code below inside the main Activity class the wallpaper changes to an image correctly, but when the code is added to the onHandleItent() the background changes to a different solid color each time. Is this a memory issue or what? Code inside Activity class - works correctly: public void ChangeWallpaper(String imagepath) { DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay()

Accessing WallpaperManager in Android 8.1

前提是你 提交于 2020-01-05 02:39:05
问题 I'm building a launcher and need to access the user's current background wallpaper but every time I launch the app I get the warning W/WallpaperManager: No permission to access wallpaper, suppressing exception to avoid crashing legacy app. in the logs. Here is the code I'm using: WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); Drawable wallpaperDrawable = wallpaperManager.getDrawable(); ImageView imageView = findViewById(R.id.background); imageView.setImageDrawable