Results 1 to 6 of 6

Thread: Set Window Wallpaper

  1. #1
    Guest
    Hello,
    Which API I should call in order to change window's Wallpaper? Thank!

  2. #2
    Guest
    I don't know about API but if you ant, I could give you a code using the registry.

  3. #3
    Guest
    The API to access the control panel elements is SystemParametersInfo.. u can retrieve and set almost anything in the control panel w/ this one... if ya want detailed code in vb on changin the wallpaper, just lemme know...

    CiD -=ii=-

  4. #4
    Guest
    Thank CiD. Please also give me detail of code on it, Thank a lot!!

  5. #5
    Guest
    Sure, heres the code:

    Code:
    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
    
    Private Const SPI_SETDESKWALLPAPER = 20
    Private Const SPIF_UPDATEINIFILE = &H1
    Private Const SPIF_SENDWININICHANGE = &H2
    
    Private Sub cmdWallPaper_Click()
    Dim rc As Long
    
    rc = SystemParametersInfo(SPI_SETDESKWALLPAPER, _
        0&, ByVal "C:\WINDOWS\MYBMP.BMP", _
        SPIF_UPDATEINIFILE Or _
        SPIF_SENDWININICHANGE)
        
    End Sub
    The parameters passed r:

    uAction - param to retrieve or set, its a constant in the API viewer that starts w/ SPI_

    uParam - value depends on action, or if retrieving set it to 0

    lpvParam - the value to be set, or returns setting when uParam is set to 0

    fuWinIni - changes to make to the win.ini (UPDATEINIFILE saves the settings to the user's profile. SENDWININICHANGE broadcasts a system change to all other apps.)

    Hope this helps..

    CiD -=ii=-

  6. #6
    Guest
    Thank, CiD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width