Jump to content

WinSetPointerOwner

From EDM2
Revision as of 18:35, 9 April 2025 by Martini (talk | contribs) (Created page with "This function is specific to OS/2 Version 2.1 or higher. This function allows an application to declare that a pointer it created can now be used by ANY process in the system (not just the process that created the pointer). ==Syntax== WinSetPointerOwner(hptr, pid, fDestroy) ==Parameters== ;hptr (HPOINTER) - Input : Handle of pointer. ;pid (PID) - Input : Process identity. ;fDestroy (BOOL) - Input : Pointer destruction flag. :;TRUE: Pointer can be destroyed...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function is specific to OS/2 Version 2.1 or higher. This function allows an application to declare that a pointer it created can now be used by ANY process in the system (not just the process that created the pointer).

Syntax

WinSetPointerOwner(hptr, pid, fDestroy)

Parameters

hptr (HPOINTER) - Input
Handle of pointer.
pid (PID) - Input
Process identity.
fDestroy (BOOL) - Input
Pointer destruction flag.
TRUE
Pointer can be destroyed by the current owner.
FALSE
Pointer cannot be destroyed by any owner.

Returns

rc (BOOL) - returns
TRUE Pointer owner successfully updated.
FALSE Pointer owner not successfully updated.

Remarks

Setting pid to 0 actually makes the pointer global (available on all processes). Setting pid to 0, or setting fDestroy to FALSE should be done with extreme care. The resources allocated with this pointer will never be freed by the system, unless the pointer is set back to an active process, and fDestroy is set to TRUE.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HPTR (0x101B) An invalid pointer handle was specified.

Example Code

#define INCL_WINPOINTERS /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HPOINTER  hptr;      /*  Handle of pointer. */
PID       pid;       /*  Process identity. */
BOOL      fDestroy; /*  Pointer destruction flag. */
BOOL      rc;       /*  Success indicator. */

rc = WinSetPointerOwner(hptr, pid, fDestroy);

This example makes a pointer global, allowing its use by other processes.

WinSetPointerOwner(hMyPtr, 0L, FALSE);

Related Functions