GpiDestroyPS: Difference between revisions
Appearance
Created page with "This function destroys the presentation space. ==Syntax== GpiDestroyPS(hps) ==Parameter== ;hps (HPS): Presentation-space handle. ==Returns== ;rc (BOOL): Success indica..." |
No edit summary |
||
Line 9: | Line 9: | ||
==Returns== | ==Returns== | ||
;rc (BOOL): Success indicator. | ;rc (BOOL): 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== | |||
<pre> | |||
#define INCL_GPICONTROL /* Or use INCL_GPI, INCL_PM, Also in COMMON section */ | |||
#include <os2.h> | |||
HPS hps; /* Presentation-space handle. */ | |||
BOOL rc; /* Success indicator. */ | |||
rc = GpiDestroyPS(hps); | |||
</pre> | |||
This example uses the GpiDestroyPS function to destroy the presentation space associated with a memory device context. | |||
<pre> | |||
#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 */ | |||
</pre> | |||
== Related Functions== | |||
* [[GpiAssociate]] | |||
* [[GpiCreatePS]] | |||
* [[GpiQueryDevice]] | |||
* [[GpiQueryPS]] | |||
* [[GpiResetPS]] | |||
* [[GpiRestorePS]] | |||
* [[GpiSavePS]] | |||
* [[GpiSetPS]] | |||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 23:51, 23 April 2025
This function destroys the presentation space.
Syntax
GpiDestroyPS(hps)
Parameter
- hps (HPS)
- Presentation-space handle.
Returns
- rc (BOOL)
- 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
#define INCL_GPICONTROL /* Or use INCL_GPI, INCL_PM, Also in COMMON section */ #include <os2.h> HPS hps; /* Presentation-space handle. */ BOOL rc; /* Success indicator. */ rc = GpiDestroyPS(hps);
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 */