1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| EnableExplicit
;@@Windows
;@author : LSI
;@link : http://www.purebasic.fr/french/viewtopic.php?t=62
;@@Linux
;@author : Progi1984
ProcedureDLL SetDesktopWallpaper(FileName.s, Style.s)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows ;{
Protected hKey.l
; style = 0 : centrer
; style = 2 : étirer
RegOpenKeyEx_(#HKEY_CURRENT_USER, "Control Panel\Desktop\", #Null, #KEY_ALL_ACCESS, @hKey)
RegSetValueEx_(hKey, "WallpaperStyle", #Null, #REG_SZ, @Style, Len(Style) + 1 )
Style = "0"
RegSetValueEx_(hKey, "TileWallpaper", #Null, #REG_SZ, @Style, Len(Style) + 1 )
SystemParametersInfo_(#SPI_SETDESKWALLPAPER, 0, FileName, #SPIF_UPDATEINIFILE | #SPIF_SENDWININICHANGE)
;}
CompilerCase #PB_OS_Linux ;{
If Style = "0"
Style = "centered"
ElseIf Style = "2"
Style = "stretched"
EndIf
RunProgram("gconftool", " -t string -s /desktop/gnome/background/picture_filename "+Chr(34)+FileName+Chr(34)+Chr(34)+Style+Chr(34), "")
;}
CompilerCase #PB_OS_MacOS ;{
; http://lists.apple.com/archives/student-dev/2004/Aug/msg00140.html
;}
CompilerEndSelect
EndProcedure
Global FileName.s = OpenFileRequester("Choix de l'image BMP", "*.bmp", "Bitmap Files (*.bmp)|*.bmp|All Files (*.*)|*.*", 1, 0)
If FileName <> ""
SetDesktopWallpaper(FileName, "2")
EndIf
|