Jump to content

GpiSaveMetaFile

From EDM2
Revision as of 18:36, 6 April 2025 by Martini (talk | contribs) (Created page with "This function saves a metafile in a disk file. ==Syntax== GpiSaveMetaFile(hmf, pszFilename) ==Parameters== ; hmf (HMF) - input : Metafile handle. ; pszFilename (PSZ) - input : The name of the file to which the metafile is to be saved. : This name must be a valid external name. It is an error if a file of this name exists already. ==Return Value== ; rc (BOOL) - returns : Success indicator. :; TRUE :: Successful completion :; FALSE :: Error occurred. ==Re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function saves a metafile in a disk file.

Syntax

GpiSaveMetaFile(hmf, pszFilename)

Parameters

hmf (HMF) - input
Metafile handle.
pszFilename (PSZ) - input
The name of the file to which the metafile is to be saved.
This name must be a valid external name. It is an error if a file of this name exists already.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

The metafile is deleted from storage; this means that the metafile handle is no longer valid. The metafile may be reaccessed by GpiLoadMetaFile.

Errors

Possible returns from WinGetLastError:

PMERR_INV_HMF (0x207E)
An invalid metafile handle was specified.
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_INSUFFICIENT_DISK_SPACE (0x203D)
The operation terminated through insufficient disk space.
PMERR_METAFILE_IN_USE (0x20D9)
An attempt has been made to access a metafile that is in use by another thread.
PMERR_TOO_MANY_METAFILES_IN_USE (0x2106)
The maximum number of metafiles allowed for a given process was exceeded.

Example Code

#define INCL_GPIMETAFILES /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HMF     hmf;         /* Metafile handle. */
PSZ     pszFilename; /* The name of the file to which the metafile is to be saved. */
BOOL    rc;          /* Success indicator. */

rc = GpiSaveMetaFile(hmf, pszFilename);

This example saves a metafile to disk.

#define INCL_GPIMETAFILES /* Metafile functions */
#include <os2.h>

HMF hmf; /* metafile handle */
PSZ pszFilename = "saved.met"; /* filename to save to */
BOOL fSuccess; /* success indicator */

fSuccess = GpiSaveMetaFile(hmf, pszFilename);

Related Functions