Results 1 to 2 of 2

Thread: *.jpg or *.gif as background ...???

  1. #1

    Thread Starter
    New Member johnyjoja's Avatar
    Join Date
    Mar 2001
    Posts
    7

    Unhappy

    I would like to know how to set a *.jpg or *gif file as your background using VB,
    I used this code,

    Public Const SPI_SETDESKWALLPAPER = 20
    Public Const SPIF_SENDWININICHANGE = &H2
    Public Const SPIF_UPDATEINIFILE = &H1

    Public Declare Function SystemParametersInfo _
    Lib "user32" Alias "SystemParametersInfoA" _
    (ByVal uAction As Long, _
    ByVal uParam As Long, _
    ByRef lpvParam As Any, _
    ByVal fuWinIni As Long) As Long

    Public Sub SetWallPaper(strFileName As String)
    Dim lngResult As Long
    Dim lngFlags As Long

    lngFlags = SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE
    lngResult = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal strFileName, lngFlags)
    End Sub

    and as used in the code:

    private sub nameofit()

    CommonDialog1.Filter = "*.bmp|*.jpg|*.gif"
    CommonDialog1.DialogTitle = "Change Wallpaper"
    CommonDialog1.Action = 1

    filename = CommonDialog1.filename
    SetWallPaper = filename

    end sub



    PLEASE HELP ME OUT...
    thnx in advance
    http://www.quartsoft.com
    Johny

  2. #2
    Guest
    SetWallPaper = filename is wrong. It wont run. Period.
    you have to take out the "=". You mayt also need Active Desktop Enabled to use jpg or gif files.

    Z.

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