Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WMF Parser

Posted on 1998-07-30
6
Medium Priority
?
831 Views
Last Modified: 2008-02-01
Does any body know about any parser for WMF files ( with source code ) readily available
on the net .. ??
0
Comment
Question by:amig
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:slinky
ID: 1112943
You can parse a WMF file using the Windows API.
The call EnumMetaFile() plus a loop to look at each of the GDI calls in turn is all you need.
0
 

Author Comment

by:amig
ID: 1112944
We can parse the Meta file using the standard api's like EnumMetaFileRecord etc. or
even by just using PlayMetaFile function.

What i am looking at is something which make the call to the appropriate GDI function depending on the Record encountered. Like making a call to CDC::LineTo() function whenever a META_LINETO record is encountered.

0
 
LVL 1

Expert Comment

by:slinky
ID: 1112945
if you enum the meta file then switch on each GDI call type in a loop you can then call the appropriate record. bit long winded but it would work...I just this approach for some code I wrote that was use to scale WMFs

I suppose you might be able to just dereference a pointer to each call and call it that way but I've never tried that
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 8

Accepted Solution

by:
Answers2000 earned 60 total points
ID: 1112946
I've had this problem

Only way is to use the Windows API to step thru the records and have a big switch (or equivalent) to call the right function.  You can't easily use a table of functions (unless you write a wrapper for each function which is just as bad) because each call takes different parameters.

If you simply want to play back the meta file onto a DC (as opposed to parse it).  The API can do this for you without you having to read the file...
0
 
LVL 1

Expert Comment

by:slinky
ID: 1112947
I think two similar answers should convince you now that this is the only way to do it.
0
 

Author Comment

by:amig
ID: 1112948
Essentially having a switch case statement (but in form of a lookup table of function ID vs function pointers ) seems to be a quite acceptable solution.

I have solved this problem in this fashion only. I can't use meta file function as i need to
use a different library call than GDI call. The problem of uniform function signature for all
the functions in the table is not an issue. I take the byte stream from the meta record
and its size as the input to the function, which is to be uniform through all the functions.
Now extraction of different parameters from this stream is different for each GDI
functions, so better we do at this function only and call appropriate GDI/Library function.

Still, i would like to have some pointer from where i can get the format used to store record corresponding to each function call. ( especially i am facing some problem to
decode the byte sequence used in ExtTextOut record. )
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
It’s easy to embed any of your public Prezi presentations on your website or social network to share with others. Learn how simple it is in this tutorial.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question