Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## GET-SIZE function

> Returns (as an INTEGER value) the allocated byte size of the memory region associated with the specified MEMPTR variable.

> Note: Does not apply to SpeedScript programming.

> #### Syntax

>     GET-SIZE ( memptr-var )

> ``memptr-var``

> A MEMPTR variable. If the variable is uninitialized (has no associated memory region), the function returns 0.

> Example

> The following example allocates three memory regions-for a BITMAPINFO structure, a BITMAPINFOHEADER structure, and an RGB color array. It then displays the allocation size for each region. 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.

> r-getsiz.p
>     DEFINE VARIABLE bitmapinfo       AS MEMPTR.
>     DEFINE VARIABLE bitmapinfoheader AS MEMPTR.
>     DEFINE VARIABLE RGBcolors        AS MEMPTR.

>     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 */

>     DISPLAY
>        GET-SIZE(bitmapinfo)
>           LABEL "Bitmap info structure size" COLON 30 SKIP
>        GET-SIZE(bitmapinfoheader)
>           LABEL "Bitmap header structure size" COLON 30 SKIP
>        GET-SIZE(RGBcolors)
>           LABEL "Bitmap colors array size" COLON 30
>     WITH SIDE-LABELS.

> #### Notes

> - To return a memory size greater than 0, the MEMPTR variable must be fully initialized, not just pre-initialized by a DLL or UNIX shared library routine.

> - MEMPTR structures are initialized using the SET-SIZE statement.

> - For more information on using the MEMPTR data type, see OpenEdge Development: Programming Interfaces .

> #### See also

> SET-SIZE statement

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095