• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Change background image of folder and desktop

Started by jep, 2008.04.15, 10:39:26

Previous topic - Next topic

jep

Marked as: Normal
Hello,

Below you'll see code on how to create a folder, open it and change the background image between the images available in the bitmap folder of the system.

The code ',S,1' below cause the images to appear scaled with factor/ratio of 1x1 for the folder.

/* Change folder (and desktop) background image */

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

obj_id = 'BG_FLDR'

If SysCreateObject( 'WPFolder', 'Test Folder Backgrounds', '<WP_DESKTOP>', 'OBJECTID=<'obj_id'>', 'U' ) then
do
   call SysSetObjectData '<'obj_id'>', 'OPEN=DEFAULT;'
   say 'One moment please...searching for images'
   call SysFileTree 'C:\OS2\BITMAP\*.*', 'file', 'FO'
   do i = 1 to file.0
      say 'Changing background to 'file.i
      call SysSetObjectData '<'obj_id'>', 'BACKGROUND='file.i',S,1;'
      call SysSleep 3
  end
end
call SysDropFuncs