Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
GpiLoadBitmap (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_GPIBITMAPS
HBITMAP GpiLoadBitmap(hps, hmod, idBitmap, lWidth, lHeight)
HPS hps; /* presentation-space handle */
HMODULE hmod; /* module handle */
USHORT idBitmap; /* bitmap identifier */
LONG lWidth; /* width in pels of the bitmap */
LONG lHeight; /* height in pels of the bitmap */
The GpiLoadBitmap function loads a bitmap resource from the specified module
and uses it to create a bitmap having the specified width and height. The
function uses the image data in the bitmap resource to initialize the bitmap
image. If the lWidth or lHeight parameter is zero, the function creates a
bitmap having the width or height given in the bitmap resource. If lWidth or
lHeight is not zero, the function stretches or compresses the bitmap image
to the specified width or height.
The bitmap handle can be used in subsequent functions that accept bitmap
handles. In most cases, the bitmap is set to a memory presentation space by
using the GpiSetBitmap function then copied to the screen or a printer by
using the GpiBitBlt function.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hps Identifies the presentation space.
hmod Specifies the module handle of the dynamic-link library
containing the bitmap resource. If this parameter is NULL, the
function loads the bitmap from the application's executable
file.
idBitmap Specifies the identifier of the bitmap within the resource file.
lWidth Specifies the width in pels of the bitmap.
lHeight Specifies the height in pels of the bitmap.
Return Value
The return value is a handle to the bitmap if the function is successful or
GPI_ERROR if an error occurred.
Errors
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
PMERR_BITMAP_NOT_FOUND
PMERR_INV_BITMAP_DIMENSION
PMERR_INV_HPS
PMERR_PS_BUSY
Example
This example uses the GpiLoadBitmap function to create a bitmap by using the
bitmap resource in the application's executable file. The bitmap must have
been added to the executable file by using Resource Compiler.
HBITMAP hbm; /* handle of the bitmap */
hbm = GpiLoadBitmap(hps, /* presentation-space handle */
(HMODULE) NULL, /* loads from application's file */
1, /* bitmap resource #1 */
64L, /* sets width to 64 pels */
64L); /* sets height to 64 pels */
See Also
GpiCreateBitmap, GpiDeleteBitmap, GpiSetBitmap, GpiSetBitmapBits,
GpiSetBitmapDimension, GpiSetBitmapId, WinGetSysBitmap, WinGetLastError
♦