Jump to content

WinGetSysBitmap: Difference between revisions

From EDM2
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) ..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 3: Line 3:
==Syntax==
==Syntax==
  WinGetSysBitmap(hwndDesktop, ibm)
  WinGetSysBitmap(hwndDesktop, ibm)
 
==Parameters==
==Parameters==
;hwndDesktop ([[HWND]]) - input
;hwndDesktop ([[HWND]]) - input:Desktop-window handle.
:Desktop-window handle.
::HWND_DESKTOP: The desktop-window handle
:;HWND_DESKTOP
::Other: Specified desktop-window handle.
::The desktop-window handle  
;ibm ([[ULONG]]) - input:System bit-map index value.
:;Other
::SBMP_SYSMENU - System menu
::Specified desktop-window handle.  
::SBMP_SYSMENUDEP - System menu in depressed state
 
::SBMP_SBUPARROW - Scroll bar up arrow
;ibm ([[ULONG]]) - input
::SBMP_SBUPARROWDEP - Scroll bar up arrow in depressed state
:System bit-map index value.
::SBMP_SBUPARROWDIS - Scroll bar up arrow in disabled state
 
::SBMP_SBDNARROW - Scroll bar down arrow
:;SBMP_SYSMENU
::SBMP_SBDNARROWDEP - Scroll bar down arrow in depressed state
            System menu  
::SBMP_SBDNARROWDIS - Scroll bar down arrow in disabled state
:;SBMP_SYSMENUDEP
::SBMP_SBRGARROW - Scroll bar right arrow
            System menu in depressed state  
::SBMP_SBRGARROWDEP - Scroll bar right arrow in depressed state
:;SBMP_SBUPARROW
::SBMP_SBRGARROWDIS - Scroll bar right arrow in disabled state
            Scroll bar up arrow  
::SBMP_SBLFARROW - Scroll bar left arrow
:;SBMP_SBUPARROWDEP
::SBMP_SBLFARROWDEP - Scroll bar left arrow in depressed state
            Scroll bar up arrow in depressed state  
::SBMP_SBLFARROWDIS - Scroll bar left arrow in disabled state
:;SBMP_SBUPARROWDIS
::SBMP_MENUCHECK - Menu check mark
            Scroll bar up arrow in disabled state  
::SBMP_MENUATTACHED - Cascading menu mark
:;SBMP_SBDNARROW
::SBMP_CHECKBOXES - Check box or radio button check marks
            Scroll bar down arrow  
::SBMP_COMBODOWN - Combobox down arrow
:;SBMP_SBDNARROWDEP
::SBMP_BTNCORNERS - Push-button corners
            Scroll bar down arrow in depressed state  
::SBMP_MINBUTTON - Minimize button
:;SBMP_SBDNARROWDIS
::SBMP_MINBUTTONDEP - Minimize button in depressed state
            Scroll bar down arrow in disabled state  
::SBMP_MAXBUTTON - Maximize button
:;SBMP_SBRGARROW
::SBMP_MAXBUTTONDEP - Maximize button in depressed state
            Scroll bar right arrow  
::SBMP_RESTOREBUTTON - Restore button
:;SBMP_SBRGARROWDEP
::SBMP_RESTOREBUTTONDEP - Restore button in depressed state
            Scroll bar right arrow in depressed state  
::SBMP_CHILDSYSMENU - System menu for child windows
:;SBMP_SBRGARROWDIS
::SBMP_CHILDSYSMENUDEP - System menu for child windows in depressed state
            Scroll bar right arrow in disabled state  
::SBMP_DRIVE - Drive
:;SBMP_SBLFARROW
::SBMP_FILE - File
            Scroll bar left arrow  
::SBMP_FOLDER - Folder
:;SBMP_SBLFARROWDEP
::SBMP_TREEPLUS - Used by the file system to indicate that an entry in the directory can be expanded.
            Scroll bar left arrow in depressed state  
::SBMP_TREEMINUS - Used by the file system to indicate that an entry in the directory can be collapsed.
:;SBMP_SBLFARROWDIS
::SBMP_PROGRAM - Used by the file system to mark .EXE and .COM files.
            Scroll bar left arrow in disabled state  
::SBMP_SIZEBOX - Used by some applications to display a sizebox in the bottom-right corner of a frame window.
:;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==
==Returns==
;hbm (HBITMAP) - returns
;hbm (HBITMAP) - returns:System bit-map handle.
:System bit-map handle.
:;NULLHANDLE:Error occurred  
:;NULLHANDLE
:;Other:System bit-map handle.
::Error occurred  
:;Other
::System bit-map handle.


==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.  
;PMERR_PARAMETER_OUT_OF_RANGE (0x1003):The value of a parameter was not within the defined valid range for that parameter.  
;PMERR_PARAMETER_OUT_OF_RANGE (0x1003)
;MERR_RESOURCE_NOT_FOUND (0x100A):The specified resource identity could not be found.
: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==
==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.  
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==
==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.
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.
Line 145: Line 101:
                     DBM_NORMAL);      /* draw normal size    */
                     DBM_NORMAL);      /* draw normal size    */
         }
         }
</pre>
Definition
<pre>
#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);
</pre>
</pre>



Revision as of 22:44, 11 December 2023

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     */
        }

Related Functions

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