Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>copymetafile()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CopyMetaFile()
Copy a metafile
------------------------------------------------------------------------------

Syntax
CopyMetaFile( <hMetaFile> , [ <cNewFile> ] )   -->   hNewMetaFile

Arguments
<hMetaFile> is the handle of the metafile which is to be
copied.

<cNewFile> optionally specifies the name of the new metafile
on disk.  It should be a valid file name.  If <cNewFile> is
nil, a memory metafile is created.

Returns
If successful, a handle to the new metafile is returned (a non-
zero numeric).  Otherwise, zero is returned.

Description
This function copies a metafile and returns a handle to the
copy.

Example
hDCMeta = CreateMetaFile( 0 )    // get a device context to record a metafile
MoveTo( hDCMeta, 50, 50 )
LineTo( hDCMeta, 150, 50 )         // draw a line
hMetaFile = CloseMetaFile( hDCMeta ) // close hDCMeta and convert to a
                                  // metafile handle
// copy the memory metafile to disk
hDiskMetaFile = CopyMetaFile( hMetaFile, "MyFile" )

hDC = GetDC( hWnd )                // get device context of window hWnd
PlayMetaFile( hDC, hMetaFile )     // play the metafile
DeleteMetaFile( hMetaFile )
SetWindowOrg( hDC, 100, 50 )       // change origin
PlayMetaFile( hDC, hDiskMetaFile ) // play the copy of the metafile
DeleteMetaFile( hDiskMetaFile )
ReleaseDC( hWnd, hDC )        // free the device context

See Also: CreateMetaFile() DeleteMetaFile() PlayMetaFile()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson