CreateEnhMetafile (EMF) and WMF
-
I have the following problem: I am creating an Enhanced metafile using OpenGL and then trying to convert it to a metafile (WMF). Right now I have to do the following: HDC hDCEnhMetaFile = CreateEnhMetaFile(.."myfile.emf"); ...do my drawing... CloseEnhMetaFile(hDCEnhMetaFile); ... HENHMETAFILE hEnhMetafile = GetEnhMetafile( "myfile.emf") GetWinMetafileBits( hEnhMetafile, pBuffer, numBytes ); HMETAFILE hMemMetafile = GetMetafile() hMemWinMetaFile = SetMetaFileBitsEx( numBytes, pBuffer ) hFileWinMetaFile = CopyMetaFile(hMemWinMetaFile, "myfile.wmf") DeleteMetaFile( hFileWinMetaFile ) DeleteMetaFile(hMemWinMetaFile ) DeleteEnhMetaFile( hEnhMetaFile ) I do NOT want to actually create an EMF file. The problem is the CreateEnhMetafile function returns an HDC not HENHMETAFILE which is required for GetWinMetafileBits - I tried to just cast the HDC to an HENHMETAFILE but this doesn't seem to work (invalid parameter error). Is there someway to get the HENHMETAFILE from an HDC? Any example code out there (I can't find anything)? Thanks Mike