CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Posts
    45

    Windowz Backroundz

    how do i change the windows backround through vb code, apparently, www.freevbcode.com and www.vbcode.com arent working right now.


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Windows Backround

    Place a button on a form and then copy in the following code :


    option Explicit
    '
    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
    '
    private Const SPIF_SENDWININICHANGE = &H2
    private Const SPIF_UPDATEINIFILE = &H1
    private Const SPI_SETDESKWALLPAPER = 20
    '
    private Sub Command1_Click()
    '
    Dim r as Long
    '
    ' Replace the 'c:\winnt\winnt256.bmp' with your required file
    '
    Call SystemParametersInfo(SPI_SETDESKWALLPAPER, _
    0&, _
    "c:\winnt\winnt256.bmp", _
    SPI_SETDESKWALLPAPER Or _
    SPIF_UPDATEINIFILE)
    '
    End Sub





    Note: This won't appear to work if the user has the ActiveDesktop enabled.


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured