GpiLoadMetaFile
Appearance
This function loads data from a file into a metafile.
Syntax
GpiLoadMetaFile(hab, pszFilename)
Parameters
- hab (HAB) - input
- Anchor-block handle.
- pszFilename (PSZ) - input
- Filename.
- The name of the file that is to be loaded into a metafile.
Return Value
- hmf (HMF) - returns
- Metafile handle or error.
- <>0
- Metafile handle
- GPI_ERROR
- Error.
Remarks
A metafile is created, into which the data from the file is loaded. The handle of the metafile created is returned in hmf; it can be used on subsequent GpiPlayMetaFile or GpiDeleteMetaFile functions.
Errors
Possible returns from WinGetLastError:
- PMERR_DOSOPEN_FAILURE (0x2024)
- A DosOpen call made during GpiLoadMetaFile or GpiSaveMetaFile gave a good return code but the file was not opened successfully.
- PMERR_DOSREAD_FAILURE (0x2025)
- A DosRead call made during GpiLoadMetaFile gave a good return code. However, it failed to read any more bytes although the file length indicated that there were more to be read.
Example Code
#define INCL_GPIMETAFILES /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PSZ pszFilename; /* Filename. */ HMF hmf; /* Metafile handle or error. */ hmf = GpiLoadMetaFile(hab, pszFilename);
This example uses the GpiLoadMetaFile function to load a metafile with data from the file sample.met. Later, the metafile is deleted by using the GpiDeleteMetaFile function.
#define INCL_GPIMETAFILES /* Metafile functions */ #include <os2.h> HAB hab; /* anchor block handle */ HMF hmf; /* metafile handle */ /* loads metafile from disk */ hmf = GpiLoadMetaFile(hab, "sample.met"); . . . GpiDeleteMetaFile(hmf); /* deletes metafile */