Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to manipulate ENHMETAHEADER?

30 views
Skip to first unread message

Ottar Holstad

unread,
Jul 11, 2006, 4:35:17 AM7/11/06
to
Hi, I'm trying to directly manipulate some of the values in the header of a
metafile. Does it make sense at all, or is the header automatically updated
by windows to reflect the contents of the metafile, and hence overwriting
"my" values?

I have tried using GetEnhMetaFileHeader, but the data returned in the buffer
is only a copy of the data in the metafile, and there isn't anything like
SetEnhMetaFileHeader to copy the changes back to the metafile. I have also
tried to loop thru the data returned by GetEnhMetaFileBits, but the header
doesn't seem to be included in the data (itype is never EMR_HEADER).


Mike D Sutton

unread,
Jul 11, 2006, 6:29:50 AM7/11/06
to

The header is a 'special' record in that you gain access to it via the GetEnhMetaFileHeader() API call as opposed to
enumeration as with all other records. In order to edit the header your best bet would be to grab the file data using
GetEnhMetaFileBits(), modify the header then create a new EMF from that using SetEnhMetaFileBits(). Unlike the WMF
format, there is no pre-header in EMF files so you can simply point an LPENHMETAHEADER at the first byte of the EMF data
buffer and modify it in place.
Alternatively depending on what you want to edit, you could also create a new Enhanced MetaDC with the new settings and
play the original into it.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: ED...@mvps.org
WWW: Http://EDais.mvps.org/


sksingh

unread,
Oct 14, 2013, 7:59:35 AM10/14/13
to
Hi Ottar,
Did u get this working eventually ?
I also need to do a similar king of thing, i.e, modify the header rclFrame size
before sending the emf file back to IDataObject::GetData call.

Thanks,
Sanjeev
0 new messages