mms00786@uxa.cso.uiuc.edu (06/05/90)
Hello. I have two questions relating to Metafiles. a) Can someone point out how to display a metafile (.wmf) that was generated using CorelDraw 1.10d? Here's how far I got - I wrote a program that does a GetClipboardData(CF_METAFILEPICT), got the lpMFPict structure, and set up my device mapping mode according to the mm, xExt, and yExt specs. I ran Corel, drew something, copied it to the clipboard, then ran my program. I was *successfully* able to import the metafile. Moreover, I was able to save the metafile to disk, then run another program that was able to correctly display the metafile. However, if I use the same drawing and ask Corel to export it to .wmf file, I am not able to display the picture. I assume it has something to do with the mapping mode etc. Anyone have any info? b) Initially, I thought I'd be ok because there's atleast one way I can get the drawing. But, I am able to copy a surprizingly small number of objects to the clipboard - a few curves, and Corel complains that metafile is too big to copy to clipboard. So how do I import a drawing from Corel? c) Why does Corel crash under the debugging version of Windows/386 when I try to cut or copy? d) Lastly, why won't the following piece of code, drawn closely from Petzold's book, work more than once? hResource = LoadResource(.... LockResource(hResource); hMF = SetMetaFileBits(hResource); GlobalUnlock (hResource); /* Set up the DC ... */ PlayMetaFile(hDC, hMF); DeleteMetaFile (hMF); The first time this code gets executed, everything is just fine - the meta file plays great. The second time around, SetMetaFileBits returns 0, meaning it failed. Why? Thanks for any pointers (or handles, if you get my drift!) Milan .
mms00786@uxa.cso.uiuc.edu (06/05/90)
...I also have a slight problem counting :-)
gjh87@ecs.soton.ac.uk (Gary Hill) (06/08/90)
In <118500017@uxa.cso.uiuc.edu> mms00786@uxa.cso.uiuc.edu writes: >a) Can someone point out how to display a metafile (.wmf) that was generated > using CorelDraw 1.10d? Here's how far I got - I wrote a program that does The problem with metafiles from CorelDraw is the format used. there is an additional 22(?) byte header containing aspect information for use by programs such as pagemaker. This is called thew placeable metafile format. If you get on to the microsoft helpline people you should be able to get the full description. There is no way of making these metafiles work as they are, cos the windows metafile routines don't know about it (clever eh!), so you will need to write a noddy program to strip 22 bytes from the front of the file. Hope this helps, I haven't time for more detail. >Milan >. Gary Hill, gjh87@uk.ac.soton.cm
mms00786@uxa.cso.uiuc.edu (06/10/90)
Thanks for everyone who replied to my queries on metafiles. FYI, Corel 1.2 with Win 3.0 will be able to cut and copy metafiles larger than 64k. Also, the .wmf files produced by Corel have a 22 byte header, which must be stripped before playing. I would still like some info on: a) the format of the 22byte header. b) why the following works only the first time it is called: hResource = LoadResource(... LockResource (hResource); hMF = SetMetaFileBits (hResource); GlobalUnlock (hResource); PlayMetaFile (hMF); DeleteMetaFile (hMF); The first time, it works. After that, SetMetaFileBits returns 0. Why? Thanks! Milan .