Solved

Changeing the wallpaper thru code

Posted on 1998-12-17
3
166 Views
Last Modified: 2010-05-03
I am rather new to programing.  I want to write a small app that when run, copies a file to the windows dir then changes the display properties to display my wallpaper.  How can I do this with code??  And with no user interaction?  I cant seem to figure out what microsoft calls it.  Please be specific in your answer so that I can understand it.  Thx
0
Comment
Question by:Zands
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
Comment Utility
Zands,
Try:
1.  Declaration
          Const SPI_SETDESKWALLPAPER = 20
          Const SPIF_UPDATEINIFILE = &H1
          Private 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

2. Code
          ' Put th picture c:\windows\setup.bmp as wallpaper
          Call SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "c:\windows\setup.bmp", SPIF_UPDATEINIFILE)

 ' get rid of Wall Paper        
          Call SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "", SPIF_UPDATEINIFILE)

Regards
Dalin
0
 

Author Comment

by:Zands
Comment Utility
It Works!  How can I have it copy a file to the windows dir?(so that I have access to it) FOR EXAMPLE:  If I put a picture in a "picture box" it dosent have to have the picture go with it to be displayed right? it is part of the exe??  how can I copy it if it was hidden on the form to the windows directory?
Do I have to use a setup program or is there a more discrete way?  I want to have some fun with this  :-)
0
 

Author Comment

by:Zands
Comment Utility
Im sorry one more thing. Since I can change the wallpaper can I change the tile property to turn it on and off ? or the stretch property?  Guess thats two :-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
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…
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…

772 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

13 Experts available now in Live!

Get 1:1 Help Now