Jump to content

WinQueryDesktopBkgnd: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 23: Line 23:


==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]].
<pre>
<pre>
#define INCL_WINDESKTOP
#define INCL_WINDESKTOP
Line 48: Line 48:
}
}
</pre>
</pre>
==Related Functions==
* [[WinSetDesktopBkgnd]]


[[Category:Win]]
[[Category:Win]]

Latest revision as of 16:29, 5 March 2024

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);
}