Previous Next

GET-POINTER-VALUE function
Returns, as an INT64 value, the address of (or pointer to) the memory region associated with the specified MEMPTR variable. The returned value is based on whether the platform supports 64-bit pointers or 32-bit pointers. On a 32-bit platform, the value never gets bigger than 2GB.
Note:
Syntax 
 
GET-POINTER-VALUE ( memptr-var )
memptr-var
A reference to a variable defined as MEMPTR. If the variable is uninitialized (has no associated memory region), the function returns 0.
Example 
This function is particularly useful when building a structure in an MEMPTR region that references other MEMPTR regions. It allows you to obtain the pointer to one MEMPTR region and store it in the structure you create in another MEMPTR region. The following example allocates three memory regions-for a BITMAPINFO structure, a BITMAPINFOHEADER structure, and an RGB color array. It then uses the GET-POINTER-VALUE function together with the PUT-LONG statement to store pointers to the BITMAPINFOHEADER structure and an RGB color array in the BITMAPINFO structure. These structures describe a device-independent bitmap for Windows dynamic link library (DLL) routines. For more information on these bitmap structures, see your Windows Software Development Kit documentation.
Note:
 
DEFINE VARIABLE bitmapinfo       AS MEMPTR NO-UNDO.
DEFINE VARIABLE bitmapinfoheader AS MEMPTR NO-UNDO.
DEFINE VARIABLE RGBcolors        AS MEMPTR NO-UNDO.
 
SET-SIZE(bitmapinfo)       = 4  /* Pointer to bitmapinfoheader */
                           + 4. /* Pointer to RGBcolors        */
 
SET-SIZE(bitmapinfoheader) = 4  /* biSize          */
                           + 4  /* biWidth         */
                           + 4  /* biHeight        */
                           + 2  /* biPlanes        */
                           + 2  /* biBitCount      */
                           + 4  /* biCompression   */
                           + 4  /* biSizeImage     */
                           + 4  /* biXpelsPerMeter */
                           + 4  /* biYPelsPerMeter */
                           + 4  /* biClrUsed       */
                           + 4. /* biClrImportant  */
 
SET-SIZE(RGBcolors)        = 16 * 4. /* Array for 16 RGB color values */
 
/* Initialize pointers to bit map info header and RGB color array */
PUT-LONG(bitmapinfo,1) = GET-POINTER-VALUE(bitmapinfoheader).
PUT-LONG(bitmapinfo,5) = GET-POINTER-VALUE(RGBcolors).
Note:
Notes 
*
*
For more information on using the MEMPTR data type, see OpenEdge Development: Programming Interfaces.
See also 
PUT-INT64 statement, PUT-LONG statement, SET-SIZE statement,

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.