Solved

WMF Parser

Posted on 1998-07-30
6
795 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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 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…
Learn how to set up basic frames and paths in Prezi and understand the open space that Prezi allows you to create presentations in.
Suggested Courses

623 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