Solved

Wallpaper api?

Posted on 2001-09-04
2
448 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
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now