I did find this article:
http://support.microsoft.com/kb/904563/
that implies there are issues when the EMF is larger than 2G, but I am
seeing a problem with smaller files (about 500M) where I create the
EMF on disk:
hMetaDC = CreateEnhMetaFile(hRefDC,"c:\\temp\\temp.emf",&rect,NULL);
and then when I want to play back the EMF:
HENHMETAFILE hMeta = CloseEnhMetaFile(hMetaDC);
fails (returns zero) but only when the file is of a sufficient length.
Are there documented limits on the size of an EMF?
Thanks,
Chris
Regards,
Rene Pilon
Usually, from our experience which coincide with yours, it's about 500
MB.
Christian
"Chris Shearer Cooper" <chris.shea...@gmail.com> wrote in
message
news:ccc22956-70ec-4999...@g19g2000yqe.googlegroups.com...
Some additional thoughts ...
* The limit is different if you are creating the metafile in memory
vs. on disk; in most cases it seems smaller for RAM vs. disk (even on
a machine with 3G free RAM my metafile fails at around 300M)
* When creating a metafile on the disk, the file appears to be created
properly (I can look in the folder and see a 800M EMF file), its only
when I try to play it back that the CloseEnhMetaFile() fails. I would
not expect that CloseEnhMetaFile() would need to read the entire EMF
into memory, so the length of the file really shouldn't matter, so I
looked in the EMF header to see if it's doing something like storing
the length of the file in a 24-bit value (and thus overflowing it) but
saw no such thing.
Chris
Well CloseEnhMetaFile finishes the EMF file, so it seems the
implementation tries to do that finalization in one big memory chunk,
which cannot be allocated and thus fail.
Christian