'This project needs
'- a common dialog box
'  (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
'   and select Microsoft Common Dialog control)
'- a button
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
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_UPDATEINIFILE = &H1
Private Sub Command1_Click()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    'Set the commondialogbox' title
    CDBox.DialogTitle = "Choose a bitmap"
    'Set the filter
    CDBox.Filter = "Windows Bitmaps (*.BMP)|*.bmp|All Files (*.*)|*.*"
    'Show the 'Open File'-dialog
    CDBox.ShowOpen
    'Change the desktop's background
    SystemParametersInfo SPI_SETDESKWALLPAPER, 0, CDBox.filename, SPIF_UPDATEINIFILE
End Sub
Private Sub Form_Load()
    Command1.Caption = "Set Wallpaper"
End Sub

解决方案 »

  1.   

    http://tech.tom.com/Archive/2002/2/4-95789.html
      

  2.   

    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 Longprivate sub form_load()
    Call SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, BMP图档名称, 
    SPIF_UPDATEINIFILE
    end sub
      

  3.   

    我用的:
        Call SystemParametersInfo(20, 0, "C:\T.BMP", &H1)    但是并没反应呀?
                      !!!!!
      

  4.   

    在一个下着暴雨的夜里,我推开CSDN的大门,再一次问了一声:
                   有    人     吗  ?
      

  5.   

    luo_yong(罗勇) 
    留下你的Email,我给你发源程序。
    myEm:
    [email protected]
      

  6.   

    在一个下着暴雨的夜里,我推开CSDN的大门,再一次问了一声:
           罗                        勇              在            吗?