Solved

Change WallPaper/Disable Active Desktop

Posted on 2003-10-30
4
355 Views
Last Modified: 2012-05-04
Hi,

I've found a few solutions to changing the wall paper in Visual Basic 6 on this site (code: see below).
However, I have run into two problems:

1) The change itself is temporary - that is if I logoff/logon, the wallpaper disappears. Am I doing something wrong?

2) If the user has active desktop activated (that is checked "Show Web Content on my Active Desktop" in Display Properties->Web) the wallpaper will not be shown. So I'm looking for away to uncheck that "Show Web........" box. I've tried putting in different registry keys (in Windows/CurVers/Policies/Explorer) which supposedly should disable Active Desktop, but rather than disabling the web content, it hides the tab called Web under Display properties, while leaving all prior settings as they were. So if the user had active desktop enabled, now he has not way of disabling it anymore = very clever! :(

Can anyone help me with these issues?

Thank you in advance.

- Erik

Code:

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

Sub Main()

Dim BitmapName As String

BitmapName=".\invi.bmp" 'full path of bitmap

If ChangeWallPaper(BitmapName) then
  MsgBox "Wallpaper was succesfuly changed"
Else
  MsgBox "Wallpaper was not changed"
End If

End Sub

Function ChangeWallPaper(WallPaperFullPath As String) As boolean
Dim Succed As Long

Succed=SystemParametersInfo(SPI_SETDESKWALLPAPER,0,WallPaperFullPath,0)
'Second and Fouth parameters must be zero (0)

  'Succed will be equal to zero (0) if function fails
  IF Succed=0 then
    ChangeWallPaper=false
  Else
    ChangeWallPaper=true
  End If
End Function
0
Comment
Question by:eibsen
4 Comments
 
LVL 5

Accepted Solution

by:
fantasy1001 earned 125 total points
ID: 9655143
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long
Const SPIF_UPDATEINIFILE = &H1
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_SENDWININICHANGE = &H2

X = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, WallPaperFullPath, SPIF_UPDATEINIFILE Or PIF_SENDWININICHANGE)

As for the "check web...", I am using XP, and the key is at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Webcheck

Thanks,
fantasy
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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

11 Experts available now in Live!

Get 1:1 Help Now