WinQueryDesktopBkgnd: Difference between revisions
Appearance
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..." |
mNo edit summary |
||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
;hwndDesktop (HWND) - input | ;hwndDesktop (HWND) - input:Desktop-window handle. | ||
:Desktop-window handle. | ::HWND_DESKTOP : The desktop window | ||
: | ::Other : Specified desktop window. | ||
;pdsk (PDESKTOP) - output:Desktop-state structure. | |||
: | |||
;pdsk (PDESKTOP) - output | |||
:Desktop-state structure. | |||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns | ;rc (BOOL) - returns:Success indicator. | ||
:Success indicator. | ::TRUE - Desktop-window status provided | ||
: | ::FALSE - Desktop-window status not provided. | ||
: | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
:PMERR_INVALID_HWND (0x1001) | :PMERR_INVALID_HWND (0x1001) : An invalid window handle was specified. | ||
:An invalid window handle was specified. | |||
==Remarks== | ==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. | 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== | ==Example Code== | ||
This example uses WinQueryDesktopBkgnd to query the current desktop background bit map before setting it to a new bit map with WinSetDesktopBkgnd. | This example uses WinQueryDesktopBkgnd to query the current desktop background bit map before setting it to a new bit map with WinSetDesktopBkgnd. | ||
Line 35: | Line 27: | ||
#define INCL_WINDESKTOP | #define INCL_WINDESKTOP | ||
#define INCL_WINWINDOWMGR | #define INCL_WINWINDOWMGR | ||
#include < | #include <os2.h> | ||
HAB hab; | HAB hab; | ||
HWND hwndDeskTop; | HWND hwndDeskTop; | ||
Line 41: | Line 33: | ||
HBITMAP hbm; | HBITMAP hbm; | ||
HBITMAP hbm_user; | HBITMAP hbm_user; | ||
WinQueryDesktopBkgnd(HWND_DESKTOP, | WinQueryDesktopBkgnd(HWND_DESKTOP, | ||
Line 48: | Line 39: | ||
if (hbm_user != DeskTopState.hbm) | if (hbm_user != DeskTopState.hbm) | ||
{ | { | ||
DeskTopState.fl = SDT_LOADFILE; | DeskTopState.fl = SDT_LOADFILE; | ||
/* the szFile is used to load the bit map because */ | /* the szFile is used to load the bit map because */ | ||
Line 57: | Line 47: | ||
&DeskTopState); | &DeskTopState); | ||
} | } | ||
</pre> | </pre> | ||
Revision as of 22:52, 11 December 2023
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); }