Wallpapers in win95

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.
Who is Participating?
DQConnect With a Mentor Commented:
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.
There's an API call to do that.  I don't remember which function.  If I have time tonight, I'll check it.

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

xer_softAuthor Commented:
This does not work! The only thing I changed is to make the function work anywhere in the program...
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
xer_softAuthor Commented:
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.
  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
xer_softAuthor Commented:
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.
xer_softAuthor Commented:
This is good enough. Thanks a bunch for all the help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.