Descriptive descriptions can be written at the same time when the EMF file is created using the createenhmetafile function;
You can use the getenhmetafiledescription function to read the description text of the EMF file.
The explanatory text in this example is very simple, but the format of the standard explanatory text should be:ProgramName #0 file title #0 #0
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; procedure alert (Sender: tobject); Procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} var hmetafile: henhmetafile; {EMF file handle} {creates an EMF file with instructions} procedure tform1.formcreate (Sender: tobject); const Path = 'C: \ temp \ mymeatefile. emf'; description = 'abcde'; {description as an EMF file} var metafiledc: HDC; begin {create and write description} metafiledc: = createenhmetafile (0, pchar (PATH ), nil, pchar (description); {drawing} rectangle (metafiledc, 11, 11,111,111); {ends editing, saving the file, and returning the file handle} hmetafile: = closeenhmetafile (metafiledc ); {Delete DC} deleteobject (metafiledc); end; {read EMF file description} procedure tform1.button1click (Sender: tobject); var descriptionsize: integer; {description segment size} descriptionbuf: pchar; {memory pointer accepted description} begin {obtain size} descriptionsize: = getenhmetafiledescription (hmetafile, 0, nil); {allocate memory} getmem (descriptionbuf, descriptionsize ); {obtain description} getenhmetafiledescription (hmetafile, descriptionsize, descriptionbuf); {display description} showmessage (descriptionbuf); {ABCDE} {release memory} freemem (descriptionbuf); end; {drawn in form} procedure tform1.button2click (Sender: tobject); begin playenhmetafile (canvas. handle, hmetafile, rect (11,11, 111,111); end; {Delete EMF file handle} procedure tform1.formdestroy (Sender: tobject); begin deleteenhmetafile (hmetafile); end.