I would like to change the desktop wallpaper in Windows (7, if that matters).
My attempt below was unsuccessful. As far as I know, it does not change the wallpaper, registry keys or anything other than printing '0'.
require 'Win32API' SPI_SETDESKWALLPAPER = 20 SPIF_UPDATEINIFILE = 0x1 SPIF_SENDWININICHANGE = 0x2 wallpaper_path = 'C:\\test.bmp' systemParametersInfo = Win32API.new('user32', 'SystemParametersInfo', ['I','I','P','I'], 'I') puts systemParametersInfo.call(SPI_SETDESKWALLPAPER, 0, wallpaper_path, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE)
2 hours of the search robot did not deliver me anywhere. Maybe someone here can help.
source share