Vaporwave and synthwave, which combine futurism and nostalgia, have become popular in recent years. We commissioned a Brazilian artist to create a vaporwave aesthetic for RAD Studio, Delphi, and C++Builder. What better way to mark the occasion than with some vaporwave desktop wallpapers and Win32 API calls? There is a separate wallpaper for RAD Studio, Delphi, and C++Builder, so you can choose which one you prefer for your desktop background. As you may know, Delphi produces native executables on Windows and is able to work very closely with the Win32 API. We would love to see all the creative ways you could mash up the backgrounds and the example application into new projects celebrating Delphi, C++Builder, and RAD Studio!
In this post, we’ll show you a simple demo application that was created that uses the SystemParametersInfo() Windows API call to set the background (wallpaper) of your Windows desktop. This should work across many versions of Windows including 11/10/8/7 and probably even older versions.
Table of Contents
How can I change the Windows background image via the API?
Here is a sample of that Win32 API call. It is literally one line of code. This API call is available to you by simply adding the Windows unit to your uses clause.
1 |
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(APath), SPIF_SENDCHANGE); |
The application is built in RAD Studio’s FireMonkey framework which is a cross-platform framework for Android, iOS, macOS, Windows, and Linux. You will see that it features three buttons; one for setting each of the 3 wallpaper backgrounds.
The full source code for the Change Windows Wallpaper project is available on GitHub and is included below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
unit uMainForm; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls, Windows, FMX.Objects, System.IOUtils, FMX.Layouts; type TMainForm = class(TForm) MaterialOxfordBlueSB: TStyleBook; BackgroundImage: TImage; Button1: TButton; GridPanelLayout1: TGridPanelLayout; Button2: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } procedure SetWallpaper(APath: String); end; var MainForm: TMainForm; implementation {$R *.fmx} procedure TMainForm.Button2Click(Sender: TObject); begin SetWallpaper(TPath.Combine(ExtractFilePath(ParamStr(0)),'delphinaut.jpg')); end; procedure TMainForm.Button3Click(Sender: TObject); begin SetWallpaper(TPath.Combine(ExtractFilePath(ParamStr(0)),'cppnaut.jpg')); end; procedure TMainForm.SetWallpaper(APath: String); begin SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(APath), SPIF_SENDCHANGE); end; procedure TMainForm.Button1Click(Sender: TObject); begin SetWallpaper(TPath.Combine(ExtractFilePath(ParamStr(0)),'radnaut.jpg')); end; end. |
Where is the RADnaut Windows wallpaper background?
The full RADnaut image is available below and available on GitHub. You can right click on it and save it from here. There is also a smaller version used as a background within the app itself and suitable for social media.
Where is the Delphinaut Windows wallpaper background?
The full Delphinaut image is available below and available on GitHub. You can right click on it and save it from here. There is also a smaller version of the background suitable for social media.
Where is the C++naut Windows wallpaper background?
The full C++naut image is available below and available on GitHub. You can right-click on it and save it from here. There is also a smaller version of the background suitable for social media.
As you can see it is really easy to access the Win32 API to change the background from within RAD Studio native Windows applications.
Head over and download the full source code for changing the Windows background wallpaper!
With RAD Studio’s Native Windows Development, you can create your own API that changes the wallpaper backgrounds. Try the free trial here.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition