Solved

Wallpaper api?

Posted on 2001-09-04
2
454 Views
Last Modified: 2008-02-01
I just need to know the windows background api name :)
the rest won't be to hard to figure out
0
Comment
Question by:molli500
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6452786
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
 
LVL 15

Expert Comment

by:lyonst
ID: 6452787
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question