Jump to content

GpiDestroyPS

From EDM2

This function destroys the presentation space.

Syntax

GpiDestroyPS(hps)

Parameter

hps (HPS) - input
Presentation-space handle.

Returns

rc (BOOL) - output
Success indicator.
TRUE: Successful completion
FALSE: Error occurred.

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_PS_IS_ASSOCIATED (0x20F5)
An attempt was made to destroy a presentation or associate a presentation space that is still associated with a device context.

Remarks

All resources owned by the presentation space are released, and any subsequent calls that use the value of the presentation space handle are rejected.

Example Code

This example uses the GpiDestroyPS function to destroy the presentation space associated with a memory device context.

#define INCL_GPICONTROL         /* GPI control Functions        */
#define INCL_DEV                /* Device Function definitions  */
#include <os2.h>

HAB          hab;       /* Anchor-block handle                  */
HPS          hps;       /* Target presentation-space handle     */
HDC          hdc;       /* Device-context handle                */
DEVOPENSTRUC dop;       /* context data structure               */
SIZEL page = { 0, 0 };  /* page size (use same as device)       */

/* Create the memory device context and presentation space. */
hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
hps = GpiCreatePS(hab, hdc, &page, PU_PELS|GPIT_MICRO|GPIA_ASSOC);
    .
    .
    .
GpiAssociate(hps, NULLHANDLE); /* disassociate device context */
GpiDestroyPS(hps);       /* destroys presentation space */
DevCloseDC(hdc);         /* closes device context       */

Related Functions