Wallpapers in win95

Posted on 1998-07-31
Last Modified: 2010-05-03
How do you change the wallpaper in win95 using VB5.0? Every one on my computer
has their own login and I only want to change it for my profile not every one.
Question by:xer_soft
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
  • 4

Expert Comment

ID: 1467374
There's an API call to do that.  I don't remember which function.  If I have time tonight, I'll check it.

Expert Comment

ID: 1467375

          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

' 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)

Author Comment

ID: 1467376
This does not work! The only thing I changed is to make the function work anywhere in the program...
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.


Expert Comment

ID: 1467377
Then you need to declare in a module:

                 Public 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

Author Comment

ID: 1467378
DQ- Thank you very much. This works great! I thank you very much. You have the points as far as I am concerned with an A  but if you please can answer this one more queston I will up the points to 70. How do you change other things like to tile an immage or not to tile an image. That is really my only other question. If you don't have an answer post another answer saying something and I will give you your 50 points.

Expert Comment

ID: 1467379
  I am not sure what you are asking, DO you want to tile a bitmap?
Here is the code:

         #If Win32 Then
             Declare Function BitBlt Lib "gdi32" _
             (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
             ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
             ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
             Declare Function BitBlt Lib "gdi" (ByVal hDestDC As Integer, _
             ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
             ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, _
             ByVal ySrc As Integer, ByVal dwRop As Long) As Integer
         #End If
         Const SRCCOPY = &HCC0020

  ' As you can see here I used conditional compilation to use the proper API call
  'for either the 32 bit or 16 bit environment.

 ' Now we will make the TilePicture procedure that will tile the picture passed
'to it onto the form. Go ahead and enter the code as you see it below.

         Public Sub TilePicture(frmDest As Form, picSource As PictureBox)
             Dim iPicWidth As Integer
             Dim iPicHeight As Integer
             Dim iFormWidth As Integer
             Dim iFormHeight As Integer
             Dim x As Integer
             Dim y As Integer
             Dim iResult As Integer
             Dim iOldScale As Integer
             'Get the picture width and height in pixels
             iOldScale = picSource.ScaleMode
             picSource.ScaleMode = 3
             iPicWidth = picSource.ScaleWidth
             iPicHeight = picSource.ScaleHeight
             picSource.ScaleMode = iOldScale
             'Get the Forms width and height in pixels
             iFormWidth = frmDest.Width / Screen.TwipsPerPixelX
             iFormHeight = frmDest.Height / Screen.TwipsPerPixelY
             For x = 0 To iFormWidth Step iPicWidth
                 For y = 0 To iFormHeight Step iPicHeight
                     iResult = BitBlt(frmDest.hDC, x, y, iPicWidth, iPicHeight, _
                     picSource.hDC, 0, 0, SRCCOPY)
         End Sub

   '     As you can see we are passsing two parameters to this function.
'         The destination form and the source picture.

'         The first thing we do is get the width of the source picture in pixels.
'    In this example I temporarily change the Scalemode to pixels then after
'     I get the  width and height I change it back.

' Next I get the Form width and height. I did this differently than the Picture just
' to show a different way to do the same thing.

'  Finally we loop through the x and y values and BitBlt the picture onto the form.

'         Now to test this procedure you will need to create a new form and place
'    a picturebox anywhere on the form. Set the picture property to anybitmap.
'         Try a smaller bitmap so you can see that it is tiling properly.

'         In the Form_Paint event insert this code.

         Private Sub Form_Paint()
             TilePicture Me, Picture1
         End Sub

Author Comment

ID: 1467380
DQ - I'm sorry for not being more clear... What I meant what if you wanted to tile a bitmap for use as a walpaper. When you go into the control panal ... display... backround   you get all kinds of other properties like pattern, wallpaper, and display. I would like to know how to change the display from tile to center or center to tile. Please forgive me for not being more clear. But that is a nice example of Bitblt! Don't worry the points are still yours! If you don't know this then I will ask a new Question some other time. Thank you very much.

Accepted Solution

DQ earned 50 total points
ID: 1467381
I don't think I know the answer, nor the question. you can using the tile code when you want to tile it, and not using it if you don't want.

Author Comment

ID: 1467382
This is good enough. Thanks a bunch for all the help!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

734 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