Solved

WMF Parser

Posted on 1998-07-30
6
755 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Web design prices 4 402
Skew Text In Photoshop 11 1,881
Using older programs/reverse engineering 5 68
Imac (Gaphic Card 4GB, 32 RAM) and After effects? 4 85
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this Micro Tutorial viewers will learn the basic shortcuts and functions of Illustrator. The viewer will learn about the paintbrush tool, anchor points, font sizing, and more.
Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …

776 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