Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Set wallpaper


'Set wallpaper API
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" ( ByVal uAction As Long , ByVal uParam As Long , ByVal lpvParam As Any, ByVal fuWinIni As Long ) As Long
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_SENDWININICHANGE = &H2
Const SPIF_UPDATEINIFILE = &H1

Dim iReturn As Long

'stretch image to fill screen
iReturn = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "c:\paper.bmp" , SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)

'center image in the screen (do not stretch)
iReturn = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "c:\paper.bmp" , 0)