realbasic-nug
[Top] [All Lists]

Re: Setting Wallpaper on Windows

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Setting Wallpaper on Windows
From: "H.M. van Staveren" <hmvs at xs4all dot nl>
Date: Fri, 30 Aug 2002 18:58:10 +0200
>Oi!  Feeling dense.  :-P  Switch the name of the function we're importing to
>be before Lib "user32"
>
Thanks that did help. No Errors during compiling but Windows said in did
not recognise SetSystemParametersInfo. After somemore googling i found
that the function is rally SystemParametersInfo. But windows didn't like 
that
either. So i found that this function is an alias for 
SystemParametersInfoA.
Now i have no more runtime errors but am still unable to change the 
wallpaper
Here's my code:

  #If TargetWin32 
  Declare Function  SystemParametersInfoA Lib "user32" (action as 
integer, param1 as integer, param2 as Ptr, updateUserProfile as integer) 
as boolean
  Dim SPI_SETDESKWALLPAPER As integer
  Dim wallpaper As Memoryblock
  Dim paperPath As String
  Dim f As FolderItem
  
  f=GetOpenFolderItem("image/jpeg")
  If f<>Nil then
    paperPath=f.absolutePath
    wallpaper = NewMemoryBlock(len(paperPath)+4)
    wallpaper.StringValue(0,len(paperPath)) = paperPath
    SPI_SETDESKWALLPAPER = 20
    if not SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, wallpaper, 0) 
then
      MsgBox "error setting wallpaper"
    end if
  End if
  #Endif

Any ideas?


<Prev in Thread] Current Thread [Next in Thread>