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
Solved

Change WallPaper/Disable Active Desktop

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

860 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