• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

Wallpaper api?

I just need to know the windows background api name :)
the rest won't be to hard to figure out
0
molli500
Asked:
molli500
1 Solution
 
TimCotteeCommented:
Option Explicit

Public 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
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE = &H2
Public Const SPIF_UPDATEINIFILE = &H1

Public Sub SetWallpaper(ByVal FileName As String)
    Dim lRet As Long
    lRet = SystemParametersInfo(SPI_SETDESKWALLPAPER, _
        0&, FileName, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
End Sub

Public Sub Main()
    SetWallpaper Replace(Command(), Chr(34), "")
    End
End Sub

Paste this lot in a module (or wherever) and it can be used to set the wallpaper to the specified bitmap.
0
 
lyonstCommented:
Is this what you are looking for

http://161.58.84.209/api/tip184.html

' Change the Windows wallpaper using the SystemParametersInfo API.

Private Sub Command1_Click()

Dim t As Long
Dim Wallpaper As String
Dim filename As String

CommonDialog1.Action = 1
filename = CommonDialog1.filename
Wallpaper = filename

If Wallpaper = "" Then Exit Sub
t = SystemParametersInfo(ByVal 20, vbnostring, ByVal Wallpaper, &H1)

If t = 0 Then
  MousePointer = 0
  MsgBox "Error changing wallpaper"
  Exit Sub
End If

End Sub
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now