December 04, 2020, 12:03:48 PM

Author Topic: [bmx] Set desktop wallpaper by JoshK [ 1+ years ago ]  (Read 478 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] Set desktop wallpaper by JoshK [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : Set desktop wallpaper
Author : JoshK
Posted : 1+ years ago

Description : Randomly choose a new desktop wallpaper from a directory

Code :
Code: BlitzMax
  1. Framework brl.linkedlist
  2. Import brl.filesystem
  3. Import brl.retro
  4.  
  5. Const SPI_SETDESKWALLPAPER=20
  6.  
  7. Extern "win32"
  8.         Function SystemParametersInfoA:Int(uiAction,uiParam,pvParam$z,fWinIni)
  9. EndExtern
  10.  
  11. bgpath$="J:DocumentsWallpapers"
  12.  
  13. Local list:TList=New TList
  14.  
  15.  
  16. d=ReadDir(bgpath)
  17. If Not d End
  18. Repeat
  19.         file$=NextFile(d)
  20.         If file="" Exit
  21.         If Lower(ExtractExt(file))="bmp"
  22.                 count:+1
  23.                 list.addlast bgpath+"/"+file
  24.         EndIf
  25. Forever
  26. CloseDir d
  27.  
  28. If list.isempty() End
  29.  
  30. bgfile$=String(list.valueatindex(Rand(0,count-1)))
  31. SystemParametersInfoA SPI_SETDESKWALLPAPER,0,bgfile,0
  32.  
  33. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal