Solved

WMF Parser

Posted on 1998-07-30
6
748 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Accepted Solution

by:
Answers2000 earned 20 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
60x60 jpgs needed 3 259
Need to create an automated "sketch" of a photo 3 67
Convert SVG to PDF 5 79
Saving html pages from the web 5 86
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
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…
In this second Micro Tutorial in the series,  viewers will learn more basic shortcuts and functions of Illustrator. In this tutorial you will learn about the eyedropper tool, zoom , ellipses and more.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

943 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now