GpiQuerySetIds
Appearance
This function returns information about all the fonts that have been created by GpiCreateLogFont, and tagged bit maps (see GpiSetBitmapId).
Syntax
GpiQuerySetIds(hps, lCount, alTypes, aNames, allcids)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lCount (LONG) - input
- The number of objects to be queried.
- The number of local identifiers (lcids) currently in use, and therefore the maximum number of objects for which information can be returned, can be found with GpiQueryNumberSetIds.
- alTypes (PLONG) - output
- Object types.
- Elements indicate whether the corresponding allcids element refers to a logical font or a tagged bit map.
- LCIDT_FONT : Font object
- LCIDT_BITMAP : Bit map.
- aNames (PSTR8) - output
- Font names.
- An array of lCount consecutive 8-byte fields, in which the 8-character names associated with the logical fonts are returned. For bit maps, the whole field is set to zeros.
- allcids (PLONG) - output
- Local identifiers.
- An array in which the local identifier (lcid) values are returned.
- LCID_DEFAULT is included if the default font has been changed (see GpiCreateLogFont).
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion
- FALSE: Error occurred.
Remarks
Each of the output parameters is an array with lCount elements. Information about the first lCount objects is returned; if there are fewer than lCount, the alTypes and allcids elements for the remainder are cleared to 0.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
Example Code
This example uses the GpiQuerySetIds function to retrieve the local identifier for all logical fonts. It then uses the identifiers to delete the logical fonts.
#define INCL_DOSMEMMGR
#define INCL_GPILCIDS
#include <OS2.H>
#define TOTALMEM 200
HPS hps; /* Presentation-space handle. */
LONG lCount; /* The number of objects to be queried. */
PLONG alTypes; /* Object types. */
ULONG rc; /* Return code. */
PSTR8 aNames; /* font names. */
PLONG allcids; /* local identifiers. */
PLONG pBase;
USHORT i;
rc = DosAllocMem((PPVOID)pBase, (ULONG)TOTALMEM*sizeof(LONG), /* space is needed for an array of */
/* lCount longs. */
PAG_READ | PAG_WRITE | PAG_COMMIT);
lCount = GpiQueryNumberSetIds(hps); /* The number of local identifiers */
/* (lcids) currently in use, and */
/* therefore the maximum number */
/* of objects for which information */
/* can be returned. */
rc = DosSubAllocMem((PVOID)pBase, (PPVOID)aNames, (ULONG)(lCount*(ULONG)sizeof(STR8)));
/* space is needed for an array of lCount longs. */
rc = DosSubAllocMem((PVOID)pBase, (PPVOID)allcids, (ULONG)lCount*sizeof(LONG));
/* space is needed for an array of lCount longs. */
rc = DosSubAllocMem((PVOID)pBase, (PPVOID)alTypes, (ULONG)lCount*sizeof(LONG));
/* space is needed for an array of lCount longs. */
GpiQuerySetIds(hps, lCount, alTypes, aNames, /* An array of lCount */
/* consecutive 8-byte fields, */
/* in which the 8-character */
/* names associated with */
/* the logical fonts are */
/* returned. For bit maps, */
/* the whole field is set to */
/* zeros. */
allcids); /* An array in which the */
/* local identifier (lcid) */
/* values are returned. */
/* LCID_DEFAULT is */
/* included if the default */
/* font has been changed */
/* (see GpiCreateLogFont). */
for (i = 1; i < lCount; i++)
{
if (allcids[i] == LCIDT_FONT)
GpiDeleteSetId(hps,allcids[i]);
}