How can I programmatically change the desktop background in Windows using basic?
- And why is it necessary? Getting into user settings, especially those not related to your application, is actually not good. - ߊߚߤߘ
|
1 answer
You can use the SystemParametersInfo API call to get and set Windows parameters, which are usually manually set from the desktop using the control panel.
Description of SystemParametersInfo API
We declare the function to change the wallpaper:
Private Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer We declare constants:
Private Const SETDESKWALLPAPER = &H14 Private Const UPDATEINIFILE = &H1 Call the function with the necessary parameters:
SystemParametersInfo(SETDESKWALLPAPER, 0, "ПутьКФайлуИзображения", UPDATEINIFILE) |