GreQueryDevResource

GreQueryDevResource indicates whether a specified resource is available. If the resource is loaded, its handle is returned so that it can be selected into the device context.

This function must be supported by the display drivers, which must support the full range of requests. GreQueryDevResource is used internally by the graphics engine. Hardcopy drivers are required to provide a minimal level of support. At a minimum, the hardcopy driver must return 0 to indicate that a requested resource is not available. If a hardcopy driver has a raster or outline font that it requests the graphics engine to use as the default, then the presentation driver must return the address of its raster or outline font when the parameter id is equal to RT_FONT.


 * Simulation support: None. This function is mandatory for all drivers.

Syntax
GreQueryDevResource(hdc, lType, id, pInstance, lFunction);

Parameters

 * hdc (HDC) - input
 * Device context handle.


 * lType (ULONG) - input
 * Resource type.


 * Resource types returned by the presentation driver:


 * RT_DISPLAYINFO
 * A structure containing some of the display constants required by the Window Manager. This information is required for all display devices that support windows. The format of the DISPLAYINFO structure is:


 * cb
 * Size of this structure (always set to 26).


 * cxIcon
 * Count of pels for x-width of icon.


 * cyIcon
 * Count of pels for y-height of icon. When WinLoadPointer is used to load the icon, it is stretched or compressed to the size indicated by cxIcon and cyIcon.


 * cxPointer
 * Count of pels for x-width of pointer.


 * cyPointer
 * Count of pels for y-height of pointer. When WinLoadPointer is used to load the pointer, it is stretched or compressed to the size indicated by cxPointer and cyPointer.


 * cxBorder
 * Count of pels for X-width of horizontal border.


 * cyBorder
 * Count of pels for Y-height vertical border.


 * cxHSlider
 * Count of pels for X-width of horizontal scroll bar slider.


 * cyVSlider
 * Count of pels for Y-height of vertical scroll bar slider.


 * cxSizeBorder
 * Count of pels for X-width of default border.


 * cySizeBorder
 * Count of pels for Y-height of default border.


 * cxDeviceAlign
 * Count of pels for horizontal device alignment.


 * cyDeviceAlign
 * Count of pels for vertical device alignment. Some display devices operate faster when operation coordinates are aligned to a BYTE, WORD or DWORD boundary.


 * The cxDeviceAlign and cyDeviceAlign parameters allow the presentation driver to align windows on these boundaries and so optimize window management operations.


 * RT_POINTER
 * Defined system pointers are:


 * SPTR_ARROW
 * Left-pointing arrow, usually the system default.


 * SPTR_TEXT
 * Text-insertion pointer, typically used when the mouse pointer is on an edit control.


 * SPTR_WAIT
 * An hourglass used to tell the user to wait while the system is busy.


 * SPTR_MOVE
 * Four arrows together, pointing north, south, east and west, that tell the user that window can be dragged in any of these directions.


 * SPTR_SIZENWSE
 * An arrow pointing northwest and southeast, that tells the user that the window can be sized in these directions.


 * SPTR_SIZENESW
 * An arrow pointing northeast and southwest, that tells the user that the window can be sized in these directions.


 * SPTR_SIZEWE
 * An arrow pointing east and west, that tells the user that the window can be sized in these directions.


 * SPTR_SIZENS
 * An arrow pointing north and south, that tells the user that the window can be sized in these directions.


 * SPTR_APPICON
 * Usually a blank icon. This is used when a window that has been sized down to its minimum (and has no normal icon) is dragged across the screen.


 * SPTR_ICONINFORMATION
 * Pointer used as part of a message box when specified in a call to WinMessageBox.


 * SPTR_ICONQUESTION
 * Pointer used as part of a message box when specified in a call to WinMessageBox.


 * SPTR_ICONERROR
 * Pointer used as part of a message box when specified in a call to WinMessageBox.


 * SPTR_ICONWARNING
 * Pointer used as part of a message box when specified in a call to WinMessageBox.


 * SPTR_ILLEGAL
 * Pointer used by the filing system to notify the user of an illegal mouse-directed copy or move operation.


 * SPTR_MULTFILE
 * Pointer used by the file system to indicate a multiple file copy or move operation.


 * SPTR_PROGRAM
 * Pointer used by the file system to indicate a copy or move operation on an executable program file.


 * SPTR_FILE
 * Pointer used by the file system to indicate a copy or move operation on an ordinary file.


 * SPTR_FOLDER
 * Pointer used by the file system to indicate a copy or move operation on an entire directory.


 * RT_BITMAP
 * The following defined system bit maps are required in display drivers:


 * SBMP_BTNCORNERS
 * Contains the rounded corners for push buttons. It is arranged as three bit maps divided into 2x2 bit-map arrays describing the corners of each bit map. The three bit maps are defined as follows:
 * Contains the corners of an unselected push button that is not a default push button.
 * Holds the corners of a default push button that is currently not selected.
 * Contains the corners of a currently selected push button, which can be either a default or nondefault push button.


 * SBMP_DRIVE
 * Used by the file system to display the logical disk drive.


 * SBMP_FILE
 * Used by the file system to indicate an unknown file type.


 * SBMP_FOLDER
 * Used by the file system to display a directory.


 * SBMP_MENUATTACHED
 * Drawn on the right edge of a menu item to indicate that a pull down menu is attached to that item.


 * SBMP_MENUCHECK
 * Displayed next to a menu item when the item is checked. Menu items are displayed in the system font and the menu checks are vertically aligned next to them. The height of this bit map must be no greater than the system font height to ensure that consecutive menu-check bit maps do not overlap. Its width is arbitrary, but is normally the same as the system font width.


 * 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.


 * SBMP_TREEMINUS
 * Used by the file system to indicate there are no more subdirectories to view.


 * SBMP_TREEPLUS
 * Used by the file system to indicate there are more subdirectories to view.


 * The following defined system bit maps are also required to ensure compatibility with OS/2 Version 1.x applications:


 * SBMP_OLD_CHILDSYSMENU
 * SBMP_OLD_CHECKBOXES
 * SBMP_OLD_MAXBUTTON
 * SBMP_OLD_MINBUTTON
 * SBMP_OLD_RESTOREBUTTON
 * SBMP_OLD_SBDNARROW
 * SBMP_OLD_SBLFARROW
 * SBMP_OLD_SBRGARROW
 * SBMP_OLD_SBUPARROW
 * SBMP_OLD_SYSMENU.


 * The following defined system bit maps are provided by PMWIN.DLL and are optional in display drivers:
 * SBMP_CHECKBOXES
 * SBMP_CHILDSYSMENU
 * SBMP_CHILDSYSMENUDEP
 * SBMP_CLOSEBUTTON
 * SBMP_CLOSEBUTTONDEP
 * SBMP_COMBODOWN
 * SBMP_MAXBUTTON
 * SBMP_MAXBUTTONDEP
 * SBMP_MINBUTTON
 * SBMP_MINBUTTONDEP
 * SBMP_RESTOREBUTTON
 * SBMP_RESTOREBUTTONDEP
 * SBMP_SBDNARROW
 * SBMP_SBDNARROWDEP
 * SBMP_SBDNARROWDIS
 * SBMP_SBLFARROW
 * SBMP_SBLFARROWDEP
 * SBMP_SBLFARROWDIS
 * SBMP_SBRGARROWDEP
 * SBMP_SBRGARROWDIS
 * SBMP_SBRGARRROW
 * SBMP_SBUPARROW
 * SBMP_SBUPARROWDEP
 * SBMP_SBUPARROWDIS
 * SBMP_SYSMENU
 * SBMP_SYSMENUDEP


 * Refer to the function "WinGetSysBitmap" in Presentation Manager Programming Reference for further explanation.


 * RT_FONT
 * The default system fonts are:


 * SFONT_RASTER
 * Default image font.
 * SFONT_OUTLINE
 * Default outline font.


 * id (ULONG) - input
 * Defined resource value.


 * pInstance (PVOID) - input
 * Pointer to instance data.


 * lFunction (ULONG) - input
 * High-order WORD=flags; low-order WORD=NGreQueryDevResource.

Return Code

 * rc (LONG) - returns
 * Return Code.


 * This function returns the address of the indicated resource-0 if no address is available, or GPI_ALTERROR if an error occurs.


 * Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:


 * PMERR_BASE_ERROR
 * PMERR_DEV_FUNC_NOT_INSTALLED


 * Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Remarks
The resources (display information, pointers, bit maps, and fonts) are stored in DLL files. Some of these resources are linked by the presentation driver when it is first enabled, others are loaded by the application with WinLoadPointer.

The two system fonts are queried by the graphics engine when the presentation driver is loaded. When the presentation driver has a default font, it returns the handle of the font, as requested. When this function returns a NULL handle for the system font, the graphics engine default fonts are used instead (see Font Functions).

Sample Code



 * 1) define INCL_GRE_DEVICE
 * 2) include 

HDC     hdc;        /*  Device context handle. */ ULONG   lType;      /*  Resource type. */ ULONG   id;         /*  Defined resource value. */ PVOID   pInstance;  /*  Pointer to instance data. */ ULONG   lFunction;  /*  High-order WORD=flags; low-order WORD=NGreQueryDevResource. */ LONG    rc;         /*  Return Code. */

rc = GreQueryDevResource(hdc, lType, id, pInstance,      lFunction);

