Solved

WMF Parser

Posted on 1998-07-30
6
738 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I've been using this technique since Adobe CS2, and it should work with any version of Illustrator that includes the appearance panel. In this tutorial we'll create a button using the appearance panel in Adobe Illustrator, and then save it as a r…
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
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.
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…

757 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

16 Experts available now in Live!

Get 1:1 Help Now