Metafile.GetMetafileHeader(const WCHAR*, MetafileHeader*) method
Applies to: desktop apps only
The Metafile::GetMetafileHeader method gets the header.
Syntax
static Status GetMetafileHeader(
[in] const WCHAR *filename,
[out] MetafileHeader *header
);
Parameters
filename [in]
Type: const WCHAR*Pointer to a wide-character string that specifies the name of an existing Metafile object that contains the header.
header [out]
Type: MetafileHeader*Pointer to a MetafileHeader object that receives the header, which contains the attributes of the metafile.
Return value
Type:
Type: Status****
If the method succeeds, it returns OK, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Examples
The following example creates a Metafile object from an EMF+ file and gets the metafile header. The code then gets the bounding rectangle of the metafile from the metafile header. Finally, the code creates a Pen object and draws the bounding rectangle.
VOID Example_GetMetafileHeader1(HDC hdc)
{
Graphics graphics(hdc);
// Create a Metafile object from an EMF+ file.
Metafile metafile = new Metafile(L"file1.emf+");
// Create a MetafileHeader object.
MetafileHeader metaHeader;
// Get the MetafileHeader.
metafile->GetMetafileHeader(L"file1.emf+", &metaHeader);
// Get the bounding rectangle of the metafile.
Rect rect;
metaHeader.GetBounds(&rect);
// Create a Pen object, and draw the bounding rectangle.
Pen pen(Color(255, 0, 0, 0));
graphics.DrawRectangle(&pen, rect);
// Delete the metafile.
delete metafile;
}
Requirements
Minimum supported client |
Windows XP, Windows 2000 Professional |
Minimum supported server |
Windows 2000 Server |
Product |
GDI+ 1.0 |
Header |
Gdiplusmetafile.h (include Gdiplus.h) |
Library |
Gdiplus.lib |
DLL |
Gdiplus.dll |
See also
Loading and Displaying Metafiles
Send comments about this topic to Microsoft
Build date: 3/6/2012