setting_20the_20desktop_20wallpaper
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
setting_20the_20desktop_20wallpaper [2018/03/31 13:19] – external edit 127.0.0.1 | setting_20the_20desktop_20wallpaper [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
//by Jon Ripley, July 2007//\\ \\ | //by Jon Ripley, July 2007//\\ \\ | ||
==== Setting the Desktop wallpaper ==== | ==== Setting the Desktop wallpaper ==== | ||
- | \\ To set the current Desktop wallpaper use the following code:\\ \\ | + | \\ To set the current Desktop wallpaper use the following code: |
+ | |||
+ | <code bb4w> | ||
SPIF_UPDATEINIFILE = 1 | SPIF_UPDATEINIFILE = 1 | ||
SPI_SETDESKWALLPAPER = 20 | SPI_SETDESKWALLPAPER = 20 | ||
SYS " | SYS " | ||
- | \\ | + | </ |
+ | |||
+ | Here the **filename$** parameter is the full path to a bitmap image (.BMP) to set as the Desktop wallpaper. To use images in unsupported file formats - such as .GIF and .PNG - as Desktop wallpaper they must first be converted to Window bitmap (.BMP) format. Under Windows Vista **filename$** can point to a JPEG image (.JPG or .JPEG). | ||
==== Removing the Desktop wallpaper ==== | ==== Removing the Desktop wallpaper ==== | ||
- | \\ | + | |
+ | To remove the current Desktop wallpaper use code similar to the following: | ||
+ | |||
+ | <code bb4w> | ||
SPIF_UPDATEINIFILE = 1 | SPIF_UPDATEINIFILE = 1 | ||
SPI_SETDESKWALLPAPER = 20 | SPI_SETDESKWALLPAPER = 20 | ||
SYS " | SYS " | ||
- | \\ | + | </ |
+ | |||
+ | Here the only difference is that the file name parameter is empty. | ||
==== Retrieving the current Desktop wallpaper ==== | ==== Retrieving the current Desktop wallpaper ==== | ||
- | \\ | + | |
+ | To retrieve the full path to the current Desktop wallpaper use code similar to the following: | ||
+ | |||
+ | <code bb4w> | ||
MAX_PATH = 260 | MAX_PATH = 260 | ||
DIM wp% MAX_PATH - 1 | DIM wp% MAX_PATH - 1 | ||
Line 21: | Line 35: | ||
SYS " | SYS " | ||
BackDrop$ = $$wp% | BackDrop$ = $$wp% | ||
- | \\ | + | </ |
+ | |||
+ | Here **BackDrop$** will contain the full path to the current Desktop wallpaper or NUL if no wallpaper is in use. As always, make sure you execute the **DIM** statement only once, or use **DIM LOCAL**, to avoid a memory leak and an eventual **No room** error. |
setting_20the_20desktop_20wallpaper.1522502381.txt.gz · Last modified: 2024/01/05 00:16 (external edit)