Solved

Change WallPaper/Disable Active Desktop

Posted on 2003-10-30
4
356 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

832 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