Results 1 to 5 of 5

Thread: wallpaper

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    trying to change wallpaper in windows
    Ihave my module which has 2 api calls
    one for win path the other for systemparametersinfo
    SPI_SETDESKWALLPAPER = 20

    I have set the path Rivetspath & point to a bmp in the windsows file Rivets.bmp

    I understand things up to here...

    retval = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal Rivetspath, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)

    ================================
    here is what I don't understand

    What are SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)

    Do I have to make declares for these?
    Do I have to do anything for these?

    I msgbox for display and I get the correct path and retval=1 but that is it..no change.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    The last parameter in your API call tells windows to update a Win.ini (using these 2 constants SPIF_SENDWININICHANGE and SPIF_UPDATEINIFILE) with the new path of your wallparper.

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  3. #3

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    Serge: that means I don't they are just do their thing?
    Here is the code I have so far but it does nothing....help!

    'module code

    Public Declare Function GetWindowsDirectory _
    Lib "kernel32" Alias "GetWindowsDirectoryA" _
    (ByVal lpBuffer As String, ByVal nSize As Long) As Long

    Public Const SPI_SETDESKWALLPAPER = 20

    'form event code

    ' Set the desktop wallpaper to the Rivets.bmp that comes with Windows.
    ' Note how the string passed to the function is preceeded by the ByVal keyword.
    Dim windir As String ' receives the path of the Windows directory
    Dim Rivetspath As String ' filename of rivets.bmp
    Dim retval As Long ' return value

    ' Get the path of the Windows directory.
    windir = Space(255) ' make room in the buffer
    retval = GetWindowsDirectory(windir, 255) ' get the path name
    windir = Left(windir, InStr(windir, vbNullChar) - 1) ' trim the null character and unused characters
    Rivetspath = windir & "\" & "Rivets.bmp" ' add the filename to the path
    ' Set the Windows wallpaper, saving the change and notifying all programs
    retval = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal Rivetspath, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)


  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Yes, it tells that when the system changes the wallpaper, it also changes the Win.INI file, so the next time windows start, this wallpaper would be loaded as well. And yes, it doesn't have to be handled yourself.

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  5. #5

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Post

    It should..but it does nothing..anyone have time to try it on their machine.

    I use vb6 win98

    Thanks,
    Wayne

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