Solved

Change WallPaper/Disable Active Desktop

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

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

Suggested Solutions

Title # Comments Views Activity
VBS file using code from 2nd file (txt or vbs) 4 57
pop out of webbrowser1 control vba6 5 52
Formula problem with Excel attachment 6 45
Problem to line 23 81
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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

752 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