Jump to content

WinGetSysBitmap

From EDM2
Revision as of 23:44, 10 December 2023 by Martini (talk | contribs) (Created page with "This function returns a handle to one of the standard bit maps provided by the system. ==Syntax== WinGetSysBitmap(hwndDesktop, ibm) ==Parameters== ;hwndDesktop (HWND) ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns a handle to one of the standard bit maps provided by the system.

Syntax

WinGetSysBitmap(hwndDesktop, ibm)

Parameters

hwndDesktop (HWND) - input
Desktop-window handle.
HWND_DESKTOP
The desktop-window handle
Other
Specified desktop-window handle.
ibm (ULONG) - input
System bit-map index value.
SBMP_SYSMENU
           System menu 
SBMP_SYSMENUDEP
           System menu in depressed state 
SBMP_SBUPARROW
           Scroll bar up arrow 
SBMP_SBUPARROWDEP
           Scroll bar up arrow in depressed state 
SBMP_SBUPARROWDIS
           Scroll bar up arrow in disabled state 
SBMP_SBDNARROW
           Scroll bar down arrow 
SBMP_SBDNARROWDEP
           Scroll bar down arrow in depressed state 
SBMP_SBDNARROWDIS
           Scroll bar down arrow in disabled state 
SBMP_SBRGARROW
           Scroll bar right arrow 
SBMP_SBRGARROWDEP
           Scroll bar right arrow in depressed state 
SBMP_SBRGARROWDIS
           Scroll bar right arrow in disabled state 
SBMP_SBLFARROW
           Scroll bar left arrow 
SBMP_SBLFARROWDEP
           Scroll bar left arrow in depressed state 
SBMP_SBLFARROWDIS
           Scroll bar left arrow in disabled state 
SBMP_MENUCHECK
           Menu check mark 
SBMP_MENUATTACHED
           Cascading menu mark SBMP_CHECKBOXES
           Check box or radio button check marks 
SBMP_COMBODOWN
           Combobox down arrow 
SBMP_BTNCORNERS
           Push-button corners 
SBMP_MINBUTTON
           Minimize button 
SBMP_MINBUTTONDEP
           Minimize button in depressed state 
SBMP_MAXBUTTON
           Maximize button 
SBMP_MAXBUTTONDEP
           Maximize button in depressed state 
SBMP_RESTOREBUTTON
           Restore button 
SBMP_RESTOREBUTTONDEP
           Restore button in depressed state 
SBMP_CHILDSYSMENU
           System menu for child windows 
SBMP_CHILDSYSMENUDEP
           System menu for child windows in depressed state 
SBMP_DRIVE
           Drive 
SBMP_FILE
           File 
SBMP_FOLDER
           Folder 
SBMP_TREEPLUS
           Used by the file system to indicate that an entry in the directory can be expanded. 
SBMP_TREEMINUS
           Used by the file system to indicate that an entry in the directory can be collapsed. 
SBMP_PROGRAM
           Used by the file system to mark .EXE and .COM files. 
SBMP_SIZEBOX
           Used by some applications to display a sizebox in the bottom-right corner of a frame window. 


Returns

hbm (HBITMAP) - returns
System bit-map handle.
NULLHANDLE
Error occurred
Other
System bit-map handle.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.
PMERR_PARAMETER_OUT_OF_RANGE (0x1003)
The value of a parameter was not within the defined valid range for that parameter.
MERR_RESOURCE_NOT_FOUND (0x100A)
The specified resource identity could not be found.

Remarks

The bit map returned can be used for any of the normal bit-map operations. This function provides a new copy of the system bit map each time it is called. The application should release any bit maps it gets with this function by using GpiDeleteBitmap.

Example Code

This example uses WinGetSysBitmap to retrieve the system defined handle for the menu check mark bit map during the window creation phase. The bit-map handle is then later used to draw the check mark in response to user selection of a menu item.

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#define INCL_WINPOINTERS        /* Window Pointer Functions     */
#define INCL_WINMESSAGEMGR      /* Window Message Functions     */
#define INCL_WINMENUS           /* Window Menu Functions        */
#include <os2.h>

HPS   hps;              /* presentation-space handle            */
HBITMAP hbmCheck;       /* check mark bit-map handle            */
HWND    hwndMenu;       /* menu handle                          */
USHORT  usItemId;       /* menu item id                         */
MPARAM  mp1;            /* Parameter 1 (menu item id)           */
MPARAM  mp2;            /* Parameter 2 (menu handle)            */
RECTL   rclItem;        /* item border rectangle                */

case WM_CREATE:
     /* obtain check mark bit-map handle */
     hbmCheck = WinGetSysBitmap(HWND_DESKTOP, SBMP_MENUCHECK);

case WM_MENUSELECT:
     usItemId = SHORT1FROMMP(mp1);
     hwndMenu = HWNDFROMMP(mp2);

     /* get rectangle of selected item */
     WinSendMsg(hwndMenu,
                MM_QUERYITEMRECT,
                MPFROM2SHORT(usItemId, TRUE),
                MPFROMP(&rclItem));

     /* draw the check mark in the lower left corner of item's
        rectangle */
     if (hbmCheck != NULL)
        {
        WinDrawBitmap(hps,
                     hbmCheck,         /* check mark           */
                     NULL,             /* draw whole bit map   */
                     (PPOINTL)&rclItem,/* bit-map destination  */
                     0L,               /* ignored since color  */
                     0L,               /* bit map */
                     DBM_NORMAL);      /* draw normal size     */
        }

Definition

 

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

HWND       hwndDesktop;  /*  Desktop-window handle. */
ULONG      ibm;          /*  System bit-map index value. */
HBITMAP    hbm;          /*  System bit-map handle. */

hbm = WinGetSysBitmap(hwndDesktop, ibm);

Related Functions

  • WinDrawBitmap
  • WinDrawBorder
  • WinDrawPointer
  • WinDrawText
  • WinFillRect
  • WinInvertRect
  • WinQueryPresParam
  • WinRemovePresParam
  • WinScrollWindow
  • WinSetPresParam