Issue reading WMF header
I am not sure if I am doing this correctly. I am trying to read the
header information of a wmf file. But however I do it I end up with
incorrect data. But, how do I know its incorrect?!! I've copied the
structure definitions for the header from here:
http://www.fileformat.info/format/wmf/egff.htm
They specifically mention that the HeaderSize field should have the
value 9. But while I try reading it I am getting some other value.
Don't know why it is so. Similarly all the other fields are
inconsistent with respect to the documentation mentioned in the web
page. Here is the code I've used.
<code>
CFile file;
CFileException fexp;
cout << "Opening file...\n";
//char* filepath = "C:\\Program Files\\Microsoft Office\\Office12\
\BITMAPS\\STYLES\\GLOBE.WMF";
if( !file.Open( _T("C:\\Program Files\\Microsoft Office\\Office12\
\BITMAPS\\STYLES\\GLOBE.WMF"), CFile::modeRead, &fexp) )
{
fexp.ReportError();
return 1;
}
cout << "Reading information...\n" ;
WMFHEAD* head = new _WindowsMetaHeader;
//reading 18 bytes
file.Read((void*) head, 18);
cout << "head->FileType : " << head->FileType << '\n' <<
"head->HeaderSize : " << head->HeaderSize << '\n' <<
"head->Version : " << head->Version << '\n' <<
"head->FileSize : " << head->FileSize << '\n' <<
"head->NumOfObjects : " << head->NumOfObjects << '\n' <<
"head->MaxRecordSize : " << head->MaxRecordSize << '\n' <<
"head->NoParameters : " << head->NoParameters << '\n';
delete head;
cout <<"Closing file...\n";
file.Close();
</code>
Hope someone can guide me on this...
--deostroll