Jump to content

WinQueryDesktopBkgnd

From EDM2
Revision as of 23:36, 10 December 2023 by Martini (talk | contribs) (Created page with "This function returns the desktop structure, which contains the information about the current state of the desktop background. ==Syntax== WinQueryDesktopBkgnd(hwndDesktop, p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the desktop structure, which contains the information about the current state of the desktop background.

Syntax

WinQueryDesktopBkgnd(hwndDesktop, pdsk)

Parameters

hwndDesktop (HWND) - input
Desktop-window handle.
HWND_DESKTOP
The desktop window
Other
Specified desktop window.
pdsk (PDESKTOP) - output
Desktop-state structure.


Returns

rc (BOOL) - returns
Success indicator.
TRUE
Desktop-window status provided
FALSE
Desktop-window status not provided.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Remarks

This function allows an application to query the background information of the desktop window. This application must be acting as the OS/2 PM shell in place of the IBM supplied shell. If the IBM supplied shell is executing it maintains control of the background of the desktop window, and WinQueryDesktopBkgnd will have no effect on the desktop window background, but will indicate a successful return code.

Example Code

This example uses WinQueryDesktopBkgnd to query the current desktop background bit map before setting it to a new bit map with WinSetDesktopBkgnd.

#define INCL_WINDESKTOP
#define INCL_WINWINDOWMGR
#include <OS2.H>
HAB hab;
HWND    hwndDeskTop;
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);
}

Definition

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND        hwndDesktop;  /*  Desktop-window handle. */
PDESKTOP    pdsk;         /*  Desktop-state structure. */
BOOL        rc;           /*  Success indicator. */

rc = WinQueryDesktopBkgnd(hwndDesktop, pdsk);

Related Functions