Results 1 to 3 of 3

Thread: How can you change the desktop wallpaper to an image?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    How can you change the desktop wallpaper to an image?

    thru vb?

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    Try this sample from www.allapi.net:
    VB Code:
    1. 'This project needs
    2. '- a common dialog box
    3. ' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
    4. ' and select Microsoft Common Dialog control)
    5. '- a command button
    6. Private Declare Function SystemParametersInfo Lib "user32" Alias _
    7.     "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
    8.     ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
    9.    
    10. Private Const SPI_SETDESKWALLPAPER = 20
    11. Private Const SPIF_UPDATEINIFILE = &H1
    12.  
    13. Private Sub Command1_Click()
    14.     'KPD-Team 1998
    15.     'URL: [url]http://www.allapi.net/[/url]
    16.     'E-Mail: [email][email protected][/email]
    17.     'Set the commondialogbox' title
    18.     CommonDialog1.DialogTitle = "Choose a bitmap"
    19.     'Set the filter
    20.     CommonDialog1.Filter = "Windows Bitmaps (*.BMP)|*.bmp|All Files (*.*)|*.*"
    21.     'Show the 'Open File'-dialog
    22.     CommonDialog1.ShowOpen
    23.     'Change the desktop's background
    24.     SystemParametersInfo SPI_SETDESKWALLPAPER, 0, CommonDialog1.FileName, SPIF_UPDATEINIFILE
    25. End Sub
    26.  
    27. Private Sub Form_Load()
    28.     Command1.Caption = "Set Wallpaper"
    29. End Sub
    ~seaweed

  3. #3
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    Always a good site to be aware of. Answered many of my questions from there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width