This example sets the desktop background with a bit map if it is not already set.

#define INCL_WINDESKTOP
#define INCL_WINWINDOWMGR
#include <OS2.H>

HWND    hwndDeskTop;
HAB     hab;
DESKTOP DeskTopState;
HBITMAP hbm;
HBITMAP hbm_user;

WinQueryDesktopBkgnd(HWND_DESKTOP,
                     &DeskTopState);

if (hbm_user != DeskTopState.hbm)
{

 DeskTopState.fl = SDT_LOADFILE;
               /* the szFile is used to load the bit map because*/
               /* the fl parameter is set to SDT_LOADFILE.      */
 strcpy(DeskTopState.szFile,"fruit.bmp");
 DeskTopState.hbm = hbm_user;
 WinSetDesktopBkgnd(hwndDeskTop,
                    &DeskTopState);
}


[Back] [Next]