please dont rip this site Prev Next

GdiComment info  Overview  Group

The GdiComment function copies a comment from a buffer into a specified enhanced-format metafile.

BOOL GdiComment(

    HDC hdc,

// handle to a device context

    UINT cbSize,

// size of text buffer

    CONST BYTE *lpData 

// pointer to text buffer



Identifies an enhanced-metafile device context.
Specifies the length of the comment buffer, in bytes.
Points to the buffer that contains the comment.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


A comment can include any kind of private information ¾ for example, the source of a picture and the date it was created. A comment should begin with an application signature, followed by the data.

Comments should not contain application-specific or position-specific data. Position-specific data specifies the location of a record, and it should not be included because one metafile may be embedded within another metafile.

A public comment is a comment that begins with the comment signature identifier GDICOMMENT_IDENTIFIER. The following public comments are defined:




The GDICOMMENT_WINDOWS_METAFILE public comment contains a Windows-format metafile that is equivalent to an enhanced-format metafile. This comment is written only by the SetWinMetaFileBits function. The comment record, if given, follows the ENHMETAHEADER metafile record. The comment has the following form:

DWORD ident;         // This contains GDICOMMENT_IDENTIFIER. 

DWORD iComment;      // This contains GDICOMMENT_WINDOWS_METAFILE. 

DWORD nVersion;      // This contains the version number of the 

                     // Windows-format metafile. 

DWORD nChecksum;     // This is the additive DWORD checksum for 

                     // the enhanced metafile.  The checksum 

                     // for the enhanced metafile data including 

                     // this comment record must be zero. 

                     // Otherwise, the enhanced metafile has been 

                     //  modified and the Windows-format 

                     // metafile is no longer valid. 

DWORD fFlags;        // This must be zero. 

DWORD cbWinMetaFile; // This is the size, in bytes. of the 

                     // Windows-format metafile data that follows. 



The GDICOMMENT_BEGINGROUP public comment identifies the beginning of a group of drawing records. It identifies an object within an enhanced metafile. The comment has the following form:

DWORD   ident;         // This contains GDICOMMENT_IDENTIFIER. 

DWORD   iComment;      // This contains GDICOMMENT_BEGINGROUP. 

RECTL   rclOutput;     // This is the bounding rectangle for the 

                       // object in logical coordinates. 

DWORD   nDescription;  // This is the number of characters in the 

                       // optional Unicode description string that 

                       // follows. This is zero if there is no 

                       // description string. 



The GDICOMMENT_ENDGROUP public comment identifies the end of a group of drawing records. The GDICOMMENT_BEGINGROUP comment and the GDICOMMENT_ENDGROUP comment must be included in a pair and may be nested. The comment has the following form:

DWORD   ident;       // This contains GDICOMMENT_IDENTIFIER. 

DWORD   iComment;    // This contains GDICOMMENT_ENDGROUP. 



The GDICOMMENT_MULTIFORMATS public comment allows multiple definitions of a picture to be included in an enhanced metafile. Using this comment, for example, an application can include an encapsulated PostScript definition as well as an enhanced metafile definition of a picture. When the record is played back, GDI selects and renders the first format recognized by the device. The comment has the following form:

DWORD   ident;          // This contains GDICOMMENT_IDENTIFIER. 

DWORD   iComment;       // This contains GDICOMMENT_MULTIFORMATS. 

RECTL   rclOutput;      // This is the bounding rectangle for the 

                        // picture in logical coordinates. 

DWORD   nFormats;       // This contains the number of formats in 

                        // the comment. 

EMRFORMAT aemrformat[1];// This is an array of EMRFORMAT structures 

                        // in the order of preference.  The data 

                        // for each format follows the last 

                        // EMRFORMAT structure. 


The EMRFORMAT structure has the following form:

typedef struct tagEMRFORMAT   { 

    DWORD   dSignature; 

    DWORD   nVersion; 

    DWORD   cbData; 

    DWORD   offData; 



See Also

CreateEnhMetaFile, EMRFORMAT, SetWinMetaFileBits 

file: /Techref/os/win/api/win32/func/src/f26_12.htm, 9KB, , updated: 2000/4/7 12:19, local time: 2024/6/17 22:45,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> GdiComment</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!