Copying a Metafile to Disk

You can copy a metafile to disk using GpiSaveMetaFile, and you can load the file back into your application using GpiLoadMetaFile. The following figure shows an example of how to copy a metafile to a file named META.MET, then load the same file back into the application and play it.

#define INCL_GPIMETAFILES
#include <os2.h>
void fncMETA03(void){
    HMF hmf;
    HAB hab;
    HPS hps;
    LONG alOpt[10];

    GpiSaveMetaFile(hmf, "meta.met");           /* Saves metafile on disk  */

    hmf = GpiLoadMetaFile(hab, "meta.met");     /* Loads metafile          */

    alOpt[PMF_SEGBASE]  = 0;                    /* Reserved                */
    alOpt[PMF_LOADTYPE] = LT_DEFAULT;           /* Default transformations */
    alOpt[PMF_RESOLVE]  = 0;                    /* Reserved                */
    alOpt[PMF_LCIDS]    = LC_DEFAULT;           /* Uses default lcids      */
    alOpt[PMF_RESET]    = RES_DEFAULT;          /* Uses default            */
    alOpt[PMF_SUPPRESS] = SUP_DEFAULT;          /* Uses default            */
    alOpt[PMF_COLORTABLES]     = CTAB_DEFAULT;  /* Uses default            */
    alOpt[PMF_COLORREALIZABLE] = CREA_DEFAULT;  /* Uses default            */

    GpiPlayMetaFile(hps, hmf, 8, alOpt, (PLONG) NULL, 0L, (PSZ) NULL);
} /* fncMETA03 */


[Back: Drawing into a Metafile in Retain Mode]
[Next: Playing a Metafile]