From: Joseph M. Newcomer on
As far as attachments, they mostly don't work in newsgroup posts. If you sent me private
email, however, my ISP has apparently installed new "security" software which is nuking
messages with attachments; I'm trying to get that fixed.

It looks like the act of playing the file is creating some implicit context, such as the
selection of stock objects and the setting of transformations, which gets added during the
playback. These implicit contexts are then made part of your file.

It is questionable why these are being added, but it appears to be part of the playback
mechanism. That's at least what it appears to be happening, given the information I see
below.
joe

On Tue, 15 Dec 2009 08:14:40 +0100, "Michael Reim"
<nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:

>Here are the records:
>E:\tmp\bild1.emf
>
> EMR_HEADER
>
> DWORD iType: 1
>
> DWORD nSize: 132
>
> RECTL rclBounds: {0, 0, 175, 175}
>
> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>
> DWORD dSignature: ' EMF'
>
> DWORD nVersion: 0x10000
>
> DWORD nBytes: 9596
>
> DWORD nRecords: 6
>
> WORD nHandles: 1
>
> WORD sReserved: 0
>
> DWORD nDescription: 12
>
> DWORD offDescription: 108
>
> [108] L"WinHCU"
>
> DWORD nPalEntries: 0
>
> SIZEL szlDevice: {1280, 1024}
>
> SIZEL szlMillimeters: {362, 290}
>
> DWORD cbPixelFormat: 0
>
> DWORD offPixelFormat: 0
>
> DWORD bOpenGL: 0
>
> SIZEL szlMicrometers: {362000, 290000}
>
> EMR_SETWINDOWORGEX
>
> POINTL ptlOrigin: {0, 0}
>
> EMR_SETWINDOWEXTEX
>
> SIZEL szlExtent: {176, 176}
>
> EMR_STRETCHBLT
>
> RECTL rclBounds: {0, 0, 175, 175}
>
> LONG xDest: 0
>
> LONG yDest: 0
>
> LONG cxDest: 176
>
> LONG cyDest: 176
>
> DWORD dwRop: SRCCOPY
>
> LONG xSrc: 0
>
> LONG ySrc: 0
>
> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>
> COLORREF crBkColorSrc: RGB(255, 255, 255)
>
> DWORD iUsageSrc: DIB_RGB_COLORS
>
> DWORD offBmiSrc: 108
>
> BITMAPINFOHEADER bmiHeader
>
> DWORD biSize: 40
>
> LONG biWidth: 48
>
> LONG biHeight: 48
>
> WORD biPlanes: 1
>
> WORD biBitCount: 32
>
> DWORD biCompression: BI_BITFIELDS
>
> DWORD biSizeImage: 9216
>
> LONG biXPelsPerMeter: 0
>
> LONG biYPelsPerMeter: 0
>
> DWORD biClrUsed: 0
>
> DWORD biClrImportant: 0
>
> RGBQUAD bmiColors[1]
>
> DWORD cbBmiSrc: 52
>
> DWORD offBitsSrc: 160
>
> DWORD cbBitsSrc: 9216
>
> LONG cxSrc: 48
>
> LONG cySrc: 48
>
> EMR_GDICOMMENT
>
> DWORD cbData: 24
>
> BYTE Data[1]
>
> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33 34
>35 36 37
>
> ...G .... .e.. .... 0123 4567
>
> EMR_EOF
>
> DWORD nPalEntries: 0
>
> DWORD offPalEntries: 16
>
> DWORD nSizeLast: 20
>
>
>
>
>E:\tmp\bild2.emf
>
> EMR_HEADER
>
> DWORD iType: 1
>
> DWORD nSize: 132
>
> RECTL rclBounds: {0, 0, 174, 174}
>
> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>
> DWORD dSignature: ' EMF'
>
> DWORD nVersion: 0x10000
>
> DWORD nBytes: 10012
>
> DWORD nRecords: 29
>
> WORD nHandles: 1
>
> WORD sReserved: 0
>
> DWORD nDescription: 12
>
> DWORD offDescription: 108
>
> [108] L"WinHCU"
>
> DWORD nPalEntries: 0
>
> SIZEL szlDevice: {1280, 1024}
>
> SIZEL szlMillimeters: {362, 290}
>
> DWORD cbPixelFormat: 0
>
> DWORD offPixelFormat: 0
>
> DWORD bOpenGL: 0
>
> SIZEL szlMicrometers: {362000, 290000}
>
> EMR_SAVEDC
>
> EMR_SETLAYOUT
>
> DWORD iMode: 0
>
> EMR_SETMETARGN
>
> EMR_SELECTOBJECT
>
> DWORD ihObject: ENHMETA_STOCK_OBJECT | WHITE_BRUSH
>
> EMR_SELECTOBJECT
>
> DWORD ihObject: ENHMETA_STOCK_OBJECT | BLACK_PEN
>
> EMR_SELECTOBJECT
>
> DWORD ihObject: ENHMETA_STOCK_OBJECT | DEVICE_DEFAULT_FONT
>
> EMR_SELECTPALETTE
>
> DWORD ihPal: ENHMETA_STOCK_OBJECT | DEFAULT_PALETTE
>
> EMR_SETBKCOLOR
>
> COLORREF crColor: RGB(255, 255, 255)
>
> EMR_SETTEXTCOLOR
>
> COLORREF crColor: RGB(0, 0, 0)
>
> EMR_SETBKMODE
>
> DWORD iMode: OPAQUE
>
> EMR_SETPOLYFILLMODE
>
> DWORD iMode: ALTERNATE
>
> EMR_SETROP2
>
> DWORD iMode: R2_COPYPEN
>
> EMR_SETSTRETCHBLTMODE
>
> DWORD iMode: STRETCH_ANDSCANS
>
> EMR_SETTEXTALIGN
>
> DWORD iMode: TA_TOP | TA_LEFT | TA_NOUPDATECP
>
> EMR_SETBRUSHORGEX
>
> POINTL ptlOrigin: {0, 0}
>
> EMR_SETMITERLIMIT
>
> FLOAT eMiterLimit: 1.4013e-044
>
> EMR_MOVETOEX
>
> POINTL ptl: {0, 0}
>
> EMR_SETWORLDTRANSFORM
>
> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>
> EMR_MODIFYWORLDTRANSFORM
>
> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>
> DWORD iMode: 4
>
> EMR_SETLAYOUT
>
> DWORD iMode: 0
>
> EMR_GDICOMMENT
>
> DWORD cbData: 52
>
> BYTE Data[1]
>
> 47 44 49 43 02 00 00 00 00 00 00 00 00 00 00 00 b1 00 00 00 b1
>00 00 00 0c 00 00 00 57 00 69 00 6e 00 48 00 43 00 55 00 00 00 74 00
>6d 00 70 00 00 00 00 00
>
> GDIC .... .... .... .... .... .... W.i. n.H. C.U. ..t. m.p. ....
>
> EMR_SETWORLDTRANSFORM
>
> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>
> EMR_MODIFYWORLDTRANSFORM
>
> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>
> DWORD iMode: 4
>
> EMR_STRETCHBLT
>
> RECTL rclBounds: {0, 0, 174, 174}
>
> LONG xDest: 0
>
> LONG yDest: 0
>
> LONG cxDest: 176
>
> LONG cyDest: 176
>
> DWORD dwRop: SRCCOPY
>
> LONG xSrc: 0
>
> LONG ySrc: 0
>
> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>
> COLORREF crBkColorSrc: RGB(255, 255, 255)
>
> DWORD iUsageSrc: DIB_RGB_COLORS
>
> DWORD offBmiSrc: 108
>
> BITMAPINFOHEADER bmiHeader
>
> DWORD biSize: 40
>
> LONG biWidth: 48
>
> LONG biHeight: 48
>
> WORD biPlanes: 1
>
> WORD biBitCount: 32
>
> DWORD biCompression: BI_BITFIELDS
>
> DWORD biSizeImage: 9216
>
> LONG biXPelsPerMeter: 0
>
> LONG biYPelsPerMeter: 0
>
> DWORD biClrUsed: 0
>
> DWORD biClrImportant: 0
>
> RGBQUAD bmiColors[1]
>
> DWORD cbBmiSrc: 52
>
> DWORD offBitsSrc: 160
>
> DWORD cbBitsSrc: 9216
>
> LONG cxSrc: 48
>
> LONG cySrc: 48
>
> EMR_GDICOMMENT
>
> DWORD cbData: 24
>
> BYTE Data[1]
>
> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33 34
>35 36 37
>
> ...G .... .e.. .... 0123 4567
>
> EMR_GDICOMMENT
>
> DWORD cbData: 8
>
> BYTE Data[1]
>
> 47 44 49 43 03 00 00 00
>
> GDIC ....
>
> EMR_RESTOREDC
>
> LONG iRelative: -1
>
> EMR_EOF
>
> DWORD nPalEntries: 0
>
> DWORD offPalEntries: 16
>
> DWORD nSizeLast: 20
>
>
>
>
>
>
>"Michael Reim"
><nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> schrieb im
>Newsbeitrag news:uOeEpSVfKHA.5608(a)TK2MSFTNGP05.phx.gbl...
>> Hello Joe,
>>
>> can't you open my attachments?
>>
>> I'll try to find your "Metafile Explorer" at the moment I'm using another
>> tool, but this is a bit tricky to copy these records into a text file.
>>
>> "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>> news:t3tci5t3mef55s9gbnvvu8g6j6gbo4n818(a)4ax.com...
>>> It would help if you knew what the new records were. Consider using my
>>> "Metafile
>>> Explorer" which you can download from my MVP Tips site. Also, in my MSDN
>>> Errors and
>>> Omissions, I have detailed documentation of the metafile records.
>>> joe
>>>
>>> On Mon, 14 Dec 2009 15:33:07 +0100, "Michael Reim"
>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>>>
>>>>Hello,
>>>>
>>>>I'm struggling with enhanced metafiles.
>>>>What I have is an enhanced metafile on disk, where I want to modify a
>>>>comment.
>>>>
>>>>Here is how I try to do this (simplified):
>>>> HENHMETAFILE hMetaFile = GetEnhMetaFile(TmpFileName);
>>>> HDC hTargetDC = CreateEnhMetaFile(DC.m_hDC, NULL, &Bounds,
>>>>_T("WinHCU\0tmp\0\0"));
>>>> EnumEnhMetaFile(hTargetDC, hMetaFile, ProtoView_EnhMetaFileReplaceProc,
>>>>NULL, &ZeichenRect);
>>>> DeleteEnhMetaFile(hMetaFile);
>>>> hMetaFile = CloseEnhMetaFile(hTargetDC);
>>>> CopyEnhMetaFile(hMetaFile, TmpFileName2);
>>>> CloseHandle(hMetaFile);
>>>>
>>>>My Callback function looks like this:
>>>> int CALLBACK ProtoView_EnhMetaFileReplaceProc(
>>>> __in HDC hDC,
>>>> __in HANDLETABLE * lpHTable,
>>>> __in const ENHMETARECORD *lpEMFR,
>>>> __in int nObj,
>>>> __in LPARAM lpData
>>>> )
>>>> {
>>>> return PlayEnhMetaFileRecord(hDC, lpHTable, lpEMFR, nObj);
>>>> }
>>>>
>>>>It's no problem for me to identify and modify the comment in the
>>>>metafile.
>>>>The problem is that the metafile increases from 6 records to 29 records
>>>>even
>>>>if I don't modify anything.
>>>>If I do this over and over again the number of records seems to double
>>>>every
>>>>time.
>>>>The same result for PlayEnhMetaFile instead of EnumEnhMetaFile.
>>>>
>>>>So how can I play one metafile into a new one without increasing the
>>>>number
>>>>of records?
>>>>
>>>>Please see the attached two files for an example. bild1.emf is the
>>>>original,
>>>>bild2.emf is the increased file.
>>>>
>>>>TIA
>>> Joseph M. Newcomer [MVP]
>>> email: newcomer(a)flounder.com
>>> Web: http://www.flounder.com
>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
>>
>>
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Michael Reim on
ok, and how can I prevent EnumEnhMetaFile from creating this implicit
context?

I'm storing my own data in a metafile comment. Which I want to modify each
time, when the user clicks a button.
At the moment this "implicit context" is getting larger with every
modification. A 9 KB file grows to 5.3 MB after just 15 modifications.


"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
news:op4fi5l8unjjthep9au21l1mjs3d3r0s6p(a)4ax.com...
> As far as attachments, they mostly don't work in newsgroup posts. If you
> sent me private
> email, however, my ISP has apparently installed new "security" software
> which is nuking
> messages with attachments; I'm trying to get that fixed.
>
> It looks like the act of playing the file is creating some implicit
> context, such as the
> selection of stock objects and the setting of transformations, which gets
> added during the
> playback. These implicit contexts are then made part of your file.
>
> It is questionable why these are being added, but it appears to be part of
> the playback
> mechanism. That's at least what it appears to be happening, given the
> information I see
> below.
> joe
>
> On Tue, 15 Dec 2009 08:14:40 +0100, "Michael Reim"
> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>
>>Here are the records:
>>E:\tmp\bild1.emf
>>
>> EMR_HEADER
>>
>> DWORD iType: 1
>>
>> DWORD nSize: 132
>>
>> RECTL rclBounds: {0, 0, 175, 175}
>>
>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>
>> DWORD dSignature: ' EMF'
>>
>> DWORD nVersion: 0x10000
>>
>> DWORD nBytes: 9596
>>
>> DWORD nRecords: 6
>>
>> WORD nHandles: 1
>>
>> WORD sReserved: 0
>>
>> DWORD nDescription: 12
>>
>> DWORD offDescription: 108
>>
>> [108] L"WinHCU"
>>
>> DWORD nPalEntries: 0
>>
>> SIZEL szlDevice: {1280, 1024}
>>
>> SIZEL szlMillimeters: {362, 290}
>>
>> DWORD cbPixelFormat: 0
>>
>> DWORD offPixelFormat: 0
>>
>> DWORD bOpenGL: 0
>>
>> SIZEL szlMicrometers: {362000, 290000}
>>
>> EMR_SETWINDOWORGEX
>>
>> POINTL ptlOrigin: {0, 0}
>>
>> EMR_SETWINDOWEXTEX
>>
>> SIZEL szlExtent: {176, 176}
>>
>> EMR_STRETCHBLT
>>
>> RECTL rclBounds: {0, 0, 175, 175}
>>
>> LONG xDest: 0
>>
>> LONG yDest: 0
>>
>> LONG cxDest: 176
>>
>> LONG cyDest: 176
>>
>> DWORD dwRop: SRCCOPY
>>
>> LONG xSrc: 0
>>
>> LONG ySrc: 0
>>
>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>
>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>
>> DWORD iUsageSrc: DIB_RGB_COLORS
>>
>> DWORD offBmiSrc: 108
>>
>> BITMAPINFOHEADER bmiHeader
>>
>> DWORD biSize: 40
>>
>> LONG biWidth: 48
>>
>> LONG biHeight: 48
>>
>> WORD biPlanes: 1
>>
>> WORD biBitCount: 32
>>
>> DWORD biCompression: BI_BITFIELDS
>>
>> DWORD biSizeImage: 9216
>>
>> LONG biXPelsPerMeter: 0
>>
>> LONG biYPelsPerMeter: 0
>>
>> DWORD biClrUsed: 0
>>
>> DWORD biClrImportant: 0
>>
>> RGBQUAD bmiColors[1]
>>
>> DWORD cbBmiSrc: 52
>>
>> DWORD offBitsSrc: 160
>>
>> DWORD cbBitsSrc: 9216
>>
>> LONG cxSrc: 48
>>
>> LONG cySrc: 48
>>
>> EMR_GDICOMMENT
>>
>> DWORD cbData: 24
>>
>> BYTE Data[1]
>>
>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>> 34
>>35 36 37
>>
>> ...G .... .e.. .... 0123 4567
>>
>> EMR_EOF
>>
>> DWORD nPalEntries: 0
>>
>> DWORD offPalEntries: 16
>>
>> DWORD nSizeLast: 20
>>
>>
>>
>>
>>E:\tmp\bild2.emf
>>
>> EMR_HEADER
>>
>> DWORD iType: 1
>>
>> DWORD nSize: 132
>>
>> RECTL rclBounds: {0, 0, 174, 174}
>>
>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>
>> DWORD dSignature: ' EMF'
>>
>> DWORD nVersion: 0x10000
>>
>> DWORD nBytes: 10012
>>
>> DWORD nRecords: 29
>>
>> WORD nHandles: 1
>>
>> WORD sReserved: 0
>>
>> DWORD nDescription: 12
>>
>> DWORD offDescription: 108
>>
>> [108] L"WinHCU"
>>
>> DWORD nPalEntries: 0
>>
>> SIZEL szlDevice: {1280, 1024}
>>
>> SIZEL szlMillimeters: {362, 290}
>>
>> DWORD cbPixelFormat: 0
>>
>> DWORD offPixelFormat: 0
>>
>> DWORD bOpenGL: 0
>>
>> SIZEL szlMicrometers: {362000, 290000}
>>
>> EMR_SAVEDC
>>
>> EMR_SETLAYOUT
>>
>> DWORD iMode: 0
>>
>> EMR_SETMETARGN
>>
>> EMR_SELECTOBJECT
>>
>> DWORD ihObject: ENHMETA_STOCK_OBJECT | WHITE_BRUSH
>>
>> EMR_SELECTOBJECT
>>
>> DWORD ihObject: ENHMETA_STOCK_OBJECT | BLACK_PEN
>>
>> EMR_SELECTOBJECT
>>
>> DWORD ihObject: ENHMETA_STOCK_OBJECT | DEVICE_DEFAULT_FONT
>>
>> EMR_SELECTPALETTE
>>
>> DWORD ihPal: ENHMETA_STOCK_OBJECT | DEFAULT_PALETTE
>>
>> EMR_SETBKCOLOR
>>
>> COLORREF crColor: RGB(255, 255, 255)
>>
>> EMR_SETTEXTCOLOR
>>
>> COLORREF crColor: RGB(0, 0, 0)
>>
>> EMR_SETBKMODE
>>
>> DWORD iMode: OPAQUE
>>
>> EMR_SETPOLYFILLMODE
>>
>> DWORD iMode: ALTERNATE
>>
>> EMR_SETROP2
>>
>> DWORD iMode: R2_COPYPEN
>>
>> EMR_SETSTRETCHBLTMODE
>>
>> DWORD iMode: STRETCH_ANDSCANS
>>
>> EMR_SETTEXTALIGN
>>
>> DWORD iMode: TA_TOP | TA_LEFT | TA_NOUPDATECP
>>
>> EMR_SETBRUSHORGEX
>>
>> POINTL ptlOrigin: {0, 0}
>>
>> EMR_SETMITERLIMIT
>>
>> FLOAT eMiterLimit: 1.4013e-044
>>
>> EMR_MOVETOEX
>>
>> POINTL ptl: {0, 0}
>>
>> EMR_SETWORLDTRANSFORM
>>
>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>
>> EMR_MODIFYWORLDTRANSFORM
>>
>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>
>> DWORD iMode: 4
>>
>> EMR_SETLAYOUT
>>
>> DWORD iMode: 0
>>
>> EMR_GDICOMMENT
>>
>> DWORD cbData: 52
>>
>> BYTE Data[1]
>>
>> 47 44 49 43 02 00 00 00 00 00 00 00 00 00 00 00 b1 00 00 00
>> b1
>>00 00 00 0c 00 00 00 57 00 69 00 6e 00 48 00 43 00 55 00 00 00 74 00
>>6d 00 70 00 00 00 00 00
>>
>> GDIC .... .... .... .... .... .... W.i. n.H. C.U. ..t. m.p. ....
>>
>> EMR_SETWORLDTRANSFORM
>>
>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>
>> EMR_MODIFYWORLDTRANSFORM
>>
>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>
>> DWORD iMode: 4
>>
>> EMR_STRETCHBLT
>>
>> RECTL rclBounds: {0, 0, 174, 174}
>>
>> LONG xDest: 0
>>
>> LONG yDest: 0
>>
>> LONG cxDest: 176
>>
>> LONG cyDest: 176
>>
>> DWORD dwRop: SRCCOPY
>>
>> LONG xSrc: 0
>>
>> LONG ySrc: 0
>>
>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>
>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>
>> DWORD iUsageSrc: DIB_RGB_COLORS
>>
>> DWORD offBmiSrc: 108
>>
>> BITMAPINFOHEADER bmiHeader
>>
>> DWORD biSize: 40
>>
>> LONG biWidth: 48
>>
>> LONG biHeight: 48
>>
>> WORD biPlanes: 1
>>
>> WORD biBitCount: 32
>>
>> DWORD biCompression: BI_BITFIELDS
>>
>> DWORD biSizeImage: 9216
>>
>> LONG biXPelsPerMeter: 0
>>
>> LONG biYPelsPerMeter: 0
>>
>> DWORD biClrUsed: 0
>>
>> DWORD biClrImportant: 0
>>
>> RGBQUAD bmiColors[1]
>>
>> DWORD cbBmiSrc: 52
>>
>> DWORD offBitsSrc: 160
>>
>> DWORD cbBitsSrc: 9216
>>
>> LONG cxSrc: 48
>>
>> LONG cySrc: 48
>>
>> EMR_GDICOMMENT
>>
>> DWORD cbData: 24
>>
>> BYTE Data[1]
>>
>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>> 34
>>35 36 37
>>
>> ...G .... .e.. .... 0123 4567
>>
>> EMR_GDICOMMENT
>>
>> DWORD cbData: 8
>>
>> BYTE Data[1]
>>
>> 47 44 49 43 03 00 00 00
>>
>> GDIC ....
>>
>> EMR_RESTOREDC
>>
>> LONG iRelative: -1
>>
>> EMR_EOF
>>
>> DWORD nPalEntries: 0
>>
>> DWORD offPalEntries: 16
>>
>> DWORD nSizeLast: 20
>>
>>
>>
>>
>>
>>
>>"Michael Reim"
>><nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> schrieb
>>im
>>Newsbeitrag news:uOeEpSVfKHA.5608(a)TK2MSFTNGP05.phx.gbl...
>>> Hello Joe,
>>>
>>> can't you open my attachments?
>>>
>>> I'll try to find your "Metafile Explorer" at the moment I'm using
>>> another
>>> tool, but this is a bit tricky to copy these records into a text file.
>>>
>>> "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>> news:t3tci5t3mef55s9gbnvvu8g6j6gbo4n818(a)4ax.com...
>>>> It would help if you knew what the new records were. Consider using my
>>>> "Metafile
>>>> Explorer" which you can download from my MVP Tips site. Also, in my
>>>> MSDN
>>>> Errors and
>>>> Omissions, I have detailed documentation of the metafile records.
>>>> joe
>>>>
>>>> On Mon, 14 Dec 2009 15:33:07 +0100, "Michael Reim"
>>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>> wrote:
>>>>
>>>>>Hello,
>>>>>
>>>>>I'm struggling with enhanced metafiles.
>>>>>What I have is an enhanced metafile on disk, where I want to modify a
>>>>>comment.
>>>>>
>>>>>Here is how I try to do this (simplified):
>>>>> HENHMETAFILE hMetaFile = GetEnhMetaFile(TmpFileName);
>>>>> HDC hTargetDC = CreateEnhMetaFile(DC.m_hDC, NULL, &Bounds,
>>>>>_T("WinHCU\0tmp\0\0"));
>>>>> EnumEnhMetaFile(hTargetDC, hMetaFile,
>>>>> ProtoView_EnhMetaFileReplaceProc,
>>>>>NULL, &ZeichenRect);
>>>>> DeleteEnhMetaFile(hMetaFile);
>>>>> hMetaFile = CloseEnhMetaFile(hTargetDC);
>>>>> CopyEnhMetaFile(hMetaFile, TmpFileName2);
>>>>> CloseHandle(hMetaFile);
>>>>>
>>>>>My Callback function looks like this:
>>>>> int CALLBACK ProtoView_EnhMetaFileReplaceProc(
>>>>> __in HDC hDC,
>>>>> __in HANDLETABLE * lpHTable,
>>>>> __in const ENHMETARECORD *lpEMFR,
>>>>> __in int nObj,
>>>>> __in LPARAM lpData
>>>>> )
>>>>> {
>>>>> return PlayEnhMetaFileRecord(hDC, lpHTable, lpEMFR, nObj);
>>>>> }
>>>>>
>>>>>It's no problem for me to identify and modify the comment in the
>>>>>metafile.
>>>>>The problem is that the metafile increases from 6 records to 29 records
>>>>>even
>>>>>if I don't modify anything.
>>>>>If I do this over and over again the number of records seems to double
>>>>>every
>>>>>time.
>>>>>The same result for PlayEnhMetaFile instead of EnumEnhMetaFile.
>>>>>
>>>>>So how can I play one metafile into a new one without increasing the
>>>>>number
>>>>>of records?
>>>>>
>>>>>Please see the attached two files for an example. bild1.emf is the
>>>>>original,
>>>>>bild2.emf is the increased file.
>>>>>
>>>>>TIA
>>>> Joseph M. Newcomer [MVP]
>>>> email: newcomer(a)flounder.com
>>>> Web: http://www.flounder.com
>>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>
>>>
>>>
>>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>


From: Joseph M. Newcomer on
That's surprising, because 15 new records of the form shown should not increase the file
significantly, and I would have assumed that because they were supplied if absent, they
would not be supplied if present. But you'd have to post this someplace like Microsoft
Connect to report it as a problem. I don't know any way to tell the playback to not
supply them.

What I'm seeing happen is that you are playing the metafile back through another metafile
DC, and creating the new metafile through that DC. Instead of doing that, why not just
read the metafile records, and write it out directly to a new file. When you get to the
one you want to modify, modify it and write it out. You can play them through a DC to do
the drawing, but it looks like playing them back through a DC is what is causing the
problem.
joe
On Tue, 15 Dec 2009 15:33:59 +0100, "Michael Reim"
<nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:

>ok, and how can I prevent EnumEnhMetaFile from creating this implicit
>context?
>
>I'm storing my own data in a metafile comment. Which I want to modify each
>time, when the user clicks a button.
>At the moment this "implicit context" is getting larger with every
>modification. A 9 KB file grows to 5.3 MB after just 15 modifications.
>
>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>news:op4fi5l8unjjthep9au21l1mjs3d3r0s6p(a)4ax.com...
>> As far as attachments, they mostly don't work in newsgroup posts. If you
>> sent me private
>> email, however, my ISP has apparently installed new "security" software
>> which is nuking
>> messages with attachments; I'm trying to get that fixed.
>>
>> It looks like the act of playing the file is creating some implicit
>> context, such as the
>> selection of stock objects and the setting of transformations, which gets
>> added during the
>> playback. These implicit contexts are then made part of your file.
>>
>> It is questionable why these are being added, but it appears to be part of
>> the playback
>> mechanism. That's at least what it appears to be happening, given the
>> information I see
>> below.
>> joe
>>
>> On Tue, 15 Dec 2009 08:14:40 +0100, "Michael Reim"
>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>>
>>>Here are the records:
>>>E:\tmp\bild1.emf
>>>
>>> EMR_HEADER
>>>
>>> DWORD iType: 1
>>>
>>> DWORD nSize: 132
>>>
>>> RECTL rclBounds: {0, 0, 175, 175}
>>>
>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>
>>> DWORD dSignature: ' EMF'
>>>
>>> DWORD nVersion: 0x10000
>>>
>>> DWORD nBytes: 9596
>>>
>>> DWORD nRecords: 6
>>>
>>> WORD nHandles: 1
>>>
>>> WORD sReserved: 0
>>>
>>> DWORD nDescription: 12
>>>
>>> DWORD offDescription: 108
>>>
>>> [108] L"WinHCU"
>>>
>>> DWORD nPalEntries: 0
>>>
>>> SIZEL szlDevice: {1280, 1024}
>>>
>>> SIZEL szlMillimeters: {362, 290}
>>>
>>> DWORD cbPixelFormat: 0
>>>
>>> DWORD offPixelFormat: 0
>>>
>>> DWORD bOpenGL: 0
>>>
>>> SIZEL szlMicrometers: {362000, 290000}
>>>
>>> EMR_SETWINDOWORGEX
>>>
>>> POINTL ptlOrigin: {0, 0}
>>>
>>> EMR_SETWINDOWEXTEX
>>>
>>> SIZEL szlExtent: {176, 176}
>>>
>>> EMR_STRETCHBLT
>>>
>>> RECTL rclBounds: {0, 0, 175, 175}
>>>
>>> LONG xDest: 0
>>>
>>> LONG yDest: 0
>>>
>>> LONG cxDest: 176
>>>
>>> LONG cyDest: 176
>>>
>>> DWORD dwRop: SRCCOPY
>>>
>>> LONG xSrc: 0
>>>
>>> LONG ySrc: 0
>>>
>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>
>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>
>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>
>>> DWORD offBmiSrc: 108
>>>
>>> BITMAPINFOHEADER bmiHeader
>>>
>>> DWORD biSize: 40
>>>
>>> LONG biWidth: 48
>>>
>>> LONG biHeight: 48
>>>
>>> WORD biPlanes: 1
>>>
>>> WORD biBitCount: 32
>>>
>>> DWORD biCompression: BI_BITFIELDS
>>>
>>> DWORD biSizeImage: 9216
>>>
>>> LONG biXPelsPerMeter: 0
>>>
>>> LONG biYPelsPerMeter: 0
>>>
>>> DWORD biClrUsed: 0
>>>
>>> DWORD biClrImportant: 0
>>>
>>> RGBQUAD bmiColors[1]
>>>
>>> DWORD cbBmiSrc: 52
>>>
>>> DWORD offBitsSrc: 160
>>>
>>> DWORD cbBitsSrc: 9216
>>>
>>> LONG cxSrc: 48
>>>
>>> LONG cySrc: 48
>>>
>>> EMR_GDICOMMENT
>>>
>>> DWORD cbData: 24
>>>
>>> BYTE Data[1]
>>>
>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>> 34
>>>35 36 37
>>>
>>> ...G .... .e.. .... 0123 4567
>>>
>>> EMR_EOF
>>>
>>> DWORD nPalEntries: 0
>>>
>>> DWORD offPalEntries: 16
>>>
>>> DWORD nSizeLast: 20
>>>
>>>
>>>
>>>
>>>E:\tmp\bild2.emf
>>>
>>> EMR_HEADER
>>>
>>> DWORD iType: 1
>>>
>>> DWORD nSize: 132
>>>
>>> RECTL rclBounds: {0, 0, 174, 174}
>>>
>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>
>>> DWORD dSignature: ' EMF'
>>>
>>> DWORD nVersion: 0x10000
>>>
>>> DWORD nBytes: 10012
>>>
>>> DWORD nRecords: 29
>>>
>>> WORD nHandles: 1
>>>
>>> WORD sReserved: 0
>>>
>>> DWORD nDescription: 12
>>>
>>> DWORD offDescription: 108
>>>
>>> [108] L"WinHCU"
>>>
>>> DWORD nPalEntries: 0
>>>
>>> SIZEL szlDevice: {1280, 1024}
>>>
>>> SIZEL szlMillimeters: {362, 290}
>>>
>>> DWORD cbPixelFormat: 0
>>>
>>> DWORD offPixelFormat: 0
>>>
>>> DWORD bOpenGL: 0
>>>
>>> SIZEL szlMicrometers: {362000, 290000}
>>>
>>> EMR_SAVEDC
>>>
>>> EMR_SETLAYOUT
>>>
>>> DWORD iMode: 0
>>>
>>> EMR_SETMETARGN
>>>
>>> EMR_SELECTOBJECT
>>>
>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | WHITE_BRUSH
>>>
>>> EMR_SELECTOBJECT
>>>
>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | BLACK_PEN
>>>
>>> EMR_SELECTOBJECT
>>>
>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | DEVICE_DEFAULT_FONT
>>>
>>> EMR_SELECTPALETTE
>>>
>>> DWORD ihPal: ENHMETA_STOCK_OBJECT | DEFAULT_PALETTE
>>>
>>> EMR_SETBKCOLOR
>>>
>>> COLORREF crColor: RGB(255, 255, 255)
>>>
>>> EMR_SETTEXTCOLOR
>>>
>>> COLORREF crColor: RGB(0, 0, 0)
>>>
>>> EMR_SETBKMODE
>>>
>>> DWORD iMode: OPAQUE
>>>
>>> EMR_SETPOLYFILLMODE
>>>
>>> DWORD iMode: ALTERNATE
>>>
>>> EMR_SETROP2
>>>
>>> DWORD iMode: R2_COPYPEN
>>>
>>> EMR_SETSTRETCHBLTMODE
>>>
>>> DWORD iMode: STRETCH_ANDSCANS
>>>
>>> EMR_SETTEXTALIGN
>>>
>>> DWORD iMode: TA_TOP | TA_LEFT | TA_NOUPDATECP
>>>
>>> EMR_SETBRUSHORGEX
>>>
>>> POINTL ptlOrigin: {0, 0}
>>>
>>> EMR_SETMITERLIMIT
>>>
>>> FLOAT eMiterLimit: 1.4013e-044
>>>
>>> EMR_MOVETOEX
>>>
>>> POINTL ptl: {0, 0}
>>>
>>> EMR_SETWORLDTRANSFORM
>>>
>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>
>>> EMR_MODIFYWORLDTRANSFORM
>>>
>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>
>>> DWORD iMode: 4
>>>
>>> EMR_SETLAYOUT
>>>
>>> DWORD iMode: 0
>>>
>>> EMR_GDICOMMENT
>>>
>>> DWORD cbData: 52
>>>
>>> BYTE Data[1]
>>>
>>> 47 44 49 43 02 00 00 00 00 00 00 00 00 00 00 00 b1 00 00 00
>>> b1
>>>00 00 00 0c 00 00 00 57 00 69 00 6e 00 48 00 43 00 55 00 00 00 74 00
>>>6d 00 70 00 00 00 00 00
>>>
>>> GDIC .... .... .... .... .... .... W.i. n.H. C.U. ..t. m.p. ....
>>>
>>> EMR_SETWORLDTRANSFORM
>>>
>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>
>>> EMR_MODIFYWORLDTRANSFORM
>>>
>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>
>>> DWORD iMode: 4
>>>
>>> EMR_STRETCHBLT
>>>
>>> RECTL rclBounds: {0, 0, 174, 174}
>>>
>>> LONG xDest: 0
>>>
>>> LONG yDest: 0
>>>
>>> LONG cxDest: 176
>>>
>>> LONG cyDest: 176
>>>
>>> DWORD dwRop: SRCCOPY
>>>
>>> LONG xSrc: 0
>>>
>>> LONG ySrc: 0
>>>
>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>
>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>
>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>
>>> DWORD offBmiSrc: 108
>>>
>>> BITMAPINFOHEADER bmiHeader
>>>
>>> DWORD biSize: 40
>>>
>>> LONG biWidth: 48
>>>
>>> LONG biHeight: 48
>>>
>>> WORD biPlanes: 1
>>>
>>> WORD biBitCount: 32
>>>
>>> DWORD biCompression: BI_BITFIELDS
>>>
>>> DWORD biSizeImage: 9216
>>>
>>> LONG biXPelsPerMeter: 0
>>>
>>> LONG biYPelsPerMeter: 0
>>>
>>> DWORD biClrUsed: 0
>>>
>>> DWORD biClrImportant: 0
>>>
>>> RGBQUAD bmiColors[1]
>>>
>>> DWORD cbBmiSrc: 52
>>>
>>> DWORD offBitsSrc: 160
>>>
>>> DWORD cbBitsSrc: 9216
>>>
>>> LONG cxSrc: 48
>>>
>>> LONG cySrc: 48
>>>
>>> EMR_GDICOMMENT
>>>
>>> DWORD cbData: 24
>>>
>>> BYTE Data[1]
>>>
>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>> 34
>>>35 36 37
>>>
>>> ...G .... .e.. .... 0123 4567
>>>
>>> EMR_GDICOMMENT
>>>
>>> DWORD cbData: 8
>>>
>>> BYTE Data[1]
>>>
>>> 47 44 49 43 03 00 00 00
>>>
>>> GDIC ....
>>>
>>> EMR_RESTOREDC
>>>
>>> LONG iRelative: -1
>>>
>>> EMR_EOF
>>>
>>> DWORD nPalEntries: 0
>>>
>>> DWORD offPalEntries: 16
>>>
>>> DWORD nSizeLast: 20
>>>
>>>
>>>
>>>
>>>
>>>
>>>"Michael Reim"
>>><nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> schrieb
>>>im
>>>Newsbeitrag news:uOeEpSVfKHA.5608(a)TK2MSFTNGP05.phx.gbl...
>>>> Hello Joe,
>>>>
>>>> can't you open my attachments?
>>>>
>>>> I'll try to find your "Metafile Explorer" at the moment I'm using
>>>> another
>>>> tool, but this is a bit tricky to copy these records into a text file.
>>>>
>>>> "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>>> news:t3tci5t3mef55s9gbnvvu8g6j6gbo4n818(a)4ax.com...
>>>>> It would help if you knew what the new records were. Consider using my
>>>>> "Metafile
>>>>> Explorer" which you can download from my MVP Tips site. Also, in my
>>>>> MSDN
>>>>> Errors and
>>>>> Omissions, I have detailed documentation of the metafile records.
>>>>> joe
>>>>>
>>>>> On Mon, 14 Dec 2009 15:33:07 +0100, "Michael Reim"
>>>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>>> wrote:
>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>I'm struggling with enhanced metafiles.
>>>>>>What I have is an enhanced metafile on disk, where I want to modify a
>>>>>>comment.
>>>>>>
>>>>>>Here is how I try to do this (simplified):
>>>>>> HENHMETAFILE hMetaFile = GetEnhMetaFile(TmpFileName);
>>>>>> HDC hTargetDC = CreateEnhMetaFile(DC.m_hDC, NULL, &Bounds,
>>>>>>_T("WinHCU\0tmp\0\0"));
>>>>>> EnumEnhMetaFile(hTargetDC, hMetaFile,
>>>>>> ProtoView_EnhMetaFileReplaceProc,
>>>>>>NULL, &ZeichenRect);
>>>>>> DeleteEnhMetaFile(hMetaFile);
>>>>>> hMetaFile = CloseEnhMetaFile(hTargetDC);
>>>>>> CopyEnhMetaFile(hMetaFile, TmpFileName2);
>>>>>> CloseHandle(hMetaFile);
>>>>>>
>>>>>>My Callback function looks like this:
>>>>>> int CALLBACK ProtoView_EnhMetaFileReplaceProc(
>>>>>> __in HDC hDC,
>>>>>> __in HANDLETABLE * lpHTable,
>>>>>> __in const ENHMETARECORD *lpEMFR,
>>>>>> __in int nObj,
>>>>>> __in LPARAM lpData
>>>>>> )
>>>>>> {
>>>>>> return PlayEnhMetaFileRecord(hDC, lpHTable, lpEMFR, nObj);
>>>>>> }
>>>>>>
>>>>>>It's no problem for me to identify and modify the comment in the
>>>>>>metafile.
>>>>>>The problem is that the metafile increases from 6 records to 29 records
>>>>>>even
>>>>>>if I don't modify anything.
>>>>>>If I do this over and over again the number of records seems to double
>>>>>>every
>>>>>>time.
>>>>>>The same result for PlayEnhMetaFile instead of EnumEnhMetaFile.
>>>>>>
>>>>>>So how can I play one metafile into a new one without increasing the
>>>>>>number
>>>>>>of records?
>>>>>>
>>>>>>Please see the attached two files for an example. bild1.emf is the
>>>>>>original,
>>>>>>bild2.emf is the increased file.
>>>>>>
>>>>>>TIA
>>>>> Joseph M. Newcomer [MVP]
>>>>> email: newcomer(a)flounder.com
>>>>> Web: http://www.flounder.com
>>>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>>
>>>>
>>>>
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Michael Reim on
I do this via EnumEnhMetaFile, because
1. it is easy to use.
2. in my real application I don't have a target file on disk, this was only
to debug the problem. I forward the handle to the metafile to an edit
control in order to show it.

But your idea sounds interesting anyway.
Do you know of a set of functions to read and write the metafile records
directly?


"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
news:0eefi5tecu7f81r1he9bbtdf9ta177gsrj(a)4ax.com...
> That's surprising, because 15 new records of the form shown should not
> increase the file
> significantly, and I would have assumed that because they were supplied if
> absent, they
> would not be supplied if present. But you'd have to post this someplace
> like Microsoft
> Connect to report it as a problem. I don't know any way to tell the
> playback to not
> supply them.
>
> What I'm seeing happen is that you are playing the metafile back through
> another metafile
> DC, and creating the new metafile through that DC. Instead of doing that,
> why not just
> read the metafile records, and write it out directly to a new file. When
> you get to the
> one you want to modify, modify it and write it out. You can play them
> through a DC to do
> the drawing, but it looks like playing them back through a DC is what is
> causing the
> problem.
> joe
> On Tue, 15 Dec 2009 15:33:59 +0100, "Michael Reim"
> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>
>>ok, and how can I prevent EnumEnhMetaFile from creating this implicit
>>context?
>>
>>I'm storing my own data in a metafile comment. Which I want to modify each
>>time, when the user clicks a button.
>>At the moment this "implicit context" is getting larger with every
>>modification. A 9 KB file grows to 5.3 MB after just 15 modifications.
>>
>>
>>"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>news:op4fi5l8unjjthep9au21l1mjs3d3r0s6p(a)4ax.com...
>>> As far as attachments, they mostly don't work in newsgroup posts. If
>>> you
>>> sent me private
>>> email, however, my ISP has apparently installed new "security" software
>>> which is nuking
>>> messages with attachments; I'm trying to get that fixed.
>>>
>>> It looks like the act of playing the file is creating some implicit
>>> context, such as the
>>> selection of stock objects and the setting of transformations, which
>>> gets
>>> added during the
>>> playback. These implicit contexts are then made part of your file.
>>>
>>> It is questionable why these are being added, but it appears to be part
>>> of
>>> the playback
>>> mechanism. That's at least what it appears to be happening, given the
>>> information I see
>>> below.
>>> joe
>>>
>>> On Tue, 15 Dec 2009 08:14:40 +0100, "Michael Reim"
>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>>>
>>>>Here are the records:
>>>>E:\tmp\bild1.emf
>>>>
>>>> EMR_HEADER
>>>>
>>>> DWORD iType: 1
>>>>
>>>> DWORD nSize: 132
>>>>
>>>> RECTL rclBounds: {0, 0, 175, 175}
>>>>
>>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>>
>>>> DWORD dSignature: ' EMF'
>>>>
>>>> DWORD nVersion: 0x10000
>>>>
>>>> DWORD nBytes: 9596
>>>>
>>>> DWORD nRecords: 6
>>>>
>>>> WORD nHandles: 1
>>>>
>>>> WORD sReserved: 0
>>>>
>>>> DWORD nDescription: 12
>>>>
>>>> DWORD offDescription: 108
>>>>
>>>> [108] L"WinHCU"
>>>>
>>>> DWORD nPalEntries: 0
>>>>
>>>> SIZEL szlDevice: {1280, 1024}
>>>>
>>>> SIZEL szlMillimeters: {362, 290}
>>>>
>>>> DWORD cbPixelFormat: 0
>>>>
>>>> DWORD offPixelFormat: 0
>>>>
>>>> DWORD bOpenGL: 0
>>>>
>>>> SIZEL szlMicrometers: {362000, 290000}
>>>>
>>>> EMR_SETWINDOWORGEX
>>>>
>>>> POINTL ptlOrigin: {0, 0}
>>>>
>>>> EMR_SETWINDOWEXTEX
>>>>
>>>> SIZEL szlExtent: {176, 176}
>>>>
>>>> EMR_STRETCHBLT
>>>>
>>>> RECTL rclBounds: {0, 0, 175, 175}
>>>>
>>>> LONG xDest: 0
>>>>
>>>> LONG yDest: 0
>>>>
>>>> LONG cxDest: 176
>>>>
>>>> LONG cyDest: 176
>>>>
>>>> DWORD dwRop: SRCCOPY
>>>>
>>>> LONG xSrc: 0
>>>>
>>>> LONG ySrc: 0
>>>>
>>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>>
>>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>>
>>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>>
>>>> DWORD offBmiSrc: 108
>>>>
>>>> BITMAPINFOHEADER bmiHeader
>>>>
>>>> DWORD biSize: 40
>>>>
>>>> LONG biWidth: 48
>>>>
>>>> LONG biHeight: 48
>>>>
>>>> WORD biPlanes: 1
>>>>
>>>> WORD biBitCount: 32
>>>>
>>>> DWORD biCompression: BI_BITFIELDS
>>>>
>>>> DWORD biSizeImage: 9216
>>>>
>>>> LONG biXPelsPerMeter: 0
>>>>
>>>> LONG biYPelsPerMeter: 0
>>>>
>>>> DWORD biClrUsed: 0
>>>>
>>>> DWORD biClrImportant: 0
>>>>
>>>> RGBQUAD bmiColors[1]
>>>>
>>>> DWORD cbBmiSrc: 52
>>>>
>>>> DWORD offBitsSrc: 160
>>>>
>>>> DWORD cbBitsSrc: 9216
>>>>
>>>> LONG cxSrc: 48
>>>>
>>>> LONG cySrc: 48
>>>>
>>>> EMR_GDICOMMENT
>>>>
>>>> DWORD cbData: 24
>>>>
>>>> BYTE Data[1]
>>>>
>>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>>> 34
>>>>35 36 37
>>>>
>>>> ...G .... .e.. .... 0123 4567
>>>>
>>>> EMR_EOF
>>>>
>>>> DWORD nPalEntries: 0
>>>>
>>>> DWORD offPalEntries: 16
>>>>
>>>> DWORD nSizeLast: 20
>>>>
>>>>
>>>>
>>>>
>>>>E:\tmp\bild2.emf
>>>>
>>>> EMR_HEADER
>>>>
>>>> DWORD iType: 1
>>>>
>>>> DWORD nSize: 132
>>>>
>>>> RECTL rclBounds: {0, 0, 174, 174}
>>>>
>>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>>
>>>> DWORD dSignature: ' EMF'
>>>>
>>>> DWORD nVersion: 0x10000
>>>>
>>>> DWORD nBytes: 10012
>>>>
>>>> DWORD nRecords: 29
>>>>
>>>> WORD nHandles: 1
>>>>
>>>> WORD sReserved: 0
>>>>
>>>> DWORD nDescription: 12
>>>>
>>>> DWORD offDescription: 108
>>>>
>>>> [108] L"WinHCU"
>>>>
>>>> DWORD nPalEntries: 0
>>>>
>>>> SIZEL szlDevice: {1280, 1024}
>>>>
>>>> SIZEL szlMillimeters: {362, 290}
>>>>
>>>> DWORD cbPixelFormat: 0
>>>>
>>>> DWORD offPixelFormat: 0
>>>>
>>>> DWORD bOpenGL: 0
>>>>
>>>> SIZEL szlMicrometers: {362000, 290000}
>>>>
>>>> EMR_SAVEDC
>>>>
>>>> EMR_SETLAYOUT
>>>>
>>>> DWORD iMode: 0
>>>>
>>>> EMR_SETMETARGN
>>>>
>>>> EMR_SELECTOBJECT
>>>>
>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | WHITE_BRUSH
>>>>
>>>> EMR_SELECTOBJECT
>>>>
>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | BLACK_PEN
>>>>
>>>> EMR_SELECTOBJECT
>>>>
>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | DEVICE_DEFAULT_FONT
>>>>
>>>> EMR_SELECTPALETTE
>>>>
>>>> DWORD ihPal: ENHMETA_STOCK_OBJECT | DEFAULT_PALETTE
>>>>
>>>> EMR_SETBKCOLOR
>>>>
>>>> COLORREF crColor: RGB(255, 255, 255)
>>>>
>>>> EMR_SETTEXTCOLOR
>>>>
>>>> COLORREF crColor: RGB(0, 0, 0)
>>>>
>>>> EMR_SETBKMODE
>>>>
>>>> DWORD iMode: OPAQUE
>>>>
>>>> EMR_SETPOLYFILLMODE
>>>>
>>>> DWORD iMode: ALTERNATE
>>>>
>>>> EMR_SETROP2
>>>>
>>>> DWORD iMode: R2_COPYPEN
>>>>
>>>> EMR_SETSTRETCHBLTMODE
>>>>
>>>> DWORD iMode: STRETCH_ANDSCANS
>>>>
>>>> EMR_SETTEXTALIGN
>>>>
>>>> DWORD iMode: TA_TOP | TA_LEFT | TA_NOUPDATECP
>>>>
>>>> EMR_SETBRUSHORGEX
>>>>
>>>> POINTL ptlOrigin: {0, 0}
>>>>
>>>> EMR_SETMITERLIMIT
>>>>
>>>> FLOAT eMiterLimit: 1.4013e-044
>>>>
>>>> EMR_MOVETOEX
>>>>
>>>> POINTL ptl: {0, 0}
>>>>
>>>> EMR_SETWORLDTRANSFORM
>>>>
>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>
>>>> EMR_MODIFYWORLDTRANSFORM
>>>>
>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>
>>>> DWORD iMode: 4
>>>>
>>>> EMR_SETLAYOUT
>>>>
>>>> DWORD iMode: 0
>>>>
>>>> EMR_GDICOMMENT
>>>>
>>>> DWORD cbData: 52
>>>>
>>>> BYTE Data[1]
>>>>
>>>> 47 44 49 43 02 00 00 00 00 00 00 00 00 00 00 00 b1 00 00 00
>>>> b1
>>>>00 00 00 0c 00 00 00 57 00 69 00 6e 00 48 00 43 00 55 00 00 00 74
>>>>00
>>>>6d 00 70 00 00 00 00 00
>>>>
>>>> GDIC .... .... .... .... .... .... W.i. n.H. C.U. ..t. m.p.
>>>> ....
>>>>
>>>> EMR_SETWORLDTRANSFORM
>>>>
>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>
>>>> EMR_MODIFYWORLDTRANSFORM
>>>>
>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>
>>>> DWORD iMode: 4
>>>>
>>>> EMR_STRETCHBLT
>>>>
>>>> RECTL rclBounds: {0, 0, 174, 174}
>>>>
>>>> LONG xDest: 0
>>>>
>>>> LONG yDest: 0
>>>>
>>>> LONG cxDest: 176
>>>>
>>>> LONG cyDest: 176
>>>>
>>>> DWORD dwRop: SRCCOPY
>>>>
>>>> LONG xSrc: 0
>>>>
>>>> LONG ySrc: 0
>>>>
>>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>>
>>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>>
>>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>>
>>>> DWORD offBmiSrc: 108
>>>>
>>>> BITMAPINFOHEADER bmiHeader
>>>>
>>>> DWORD biSize: 40
>>>>
>>>> LONG biWidth: 48
>>>>
>>>> LONG biHeight: 48
>>>>
>>>> WORD biPlanes: 1
>>>>
>>>> WORD biBitCount: 32
>>>>
>>>> DWORD biCompression: BI_BITFIELDS
>>>>
>>>> DWORD biSizeImage: 9216
>>>>
>>>> LONG biXPelsPerMeter: 0
>>>>
>>>> LONG biYPelsPerMeter: 0
>>>>
>>>> DWORD biClrUsed: 0
>>>>
>>>> DWORD biClrImportant: 0
>>>>
>>>> RGBQUAD bmiColors[1]
>>>>
>>>> DWORD cbBmiSrc: 52
>>>>
>>>> DWORD offBitsSrc: 160
>>>>
>>>> DWORD cbBitsSrc: 9216
>>>>
>>>> LONG cxSrc: 48
>>>>
>>>> LONG cySrc: 48
>>>>
>>>> EMR_GDICOMMENT
>>>>
>>>> DWORD cbData: 24
>>>>
>>>> BYTE Data[1]
>>>>
>>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>>> 34
>>>>35 36 37
>>>>
>>>> ...G .... .e.. .... 0123 4567
>>>>
>>>> EMR_GDICOMMENT
>>>>
>>>> DWORD cbData: 8
>>>>
>>>> BYTE Data[1]
>>>>
>>>> 47 44 49 43 03 00 00 00
>>>>
>>>> GDIC ....
>>>>
>>>> EMR_RESTOREDC
>>>>
>>>> LONG iRelative: -1
>>>>
>>>> EMR_EOF
>>>>
>>>> DWORD nPalEntries: 0
>>>>
>>>> DWORD offPalEntries: 16
>>>>
>>>> DWORD nSizeLast: 20
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>"Michael Reim"
>>>><nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>>schrieb
>>>>im
>>>>Newsbeitrag news:uOeEpSVfKHA.5608(a)TK2MSFTNGP05.phx.gbl...
>>>>> Hello Joe,
>>>>>
>>>>> can't you open my attachments?
>>>>>
>>>>> I'll try to find your "Metafile Explorer" at the moment I'm using
>>>>> another
>>>>> tool, but this is a bit tricky to copy these records into a text file.
>>>>>
>>>>> "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>>>> news:t3tci5t3mef55s9gbnvvu8g6j6gbo4n818(a)4ax.com...
>>>>>> It would help if you knew what the new records were. Consider using
>>>>>> my
>>>>>> "Metafile
>>>>>> Explorer" which you can download from my MVP Tips site. Also, in my
>>>>>> MSDN
>>>>>> Errors and
>>>>>> Omissions, I have detailed documentation of the metafile records.
>>>>>> joe
>>>>>>
>>>>>> On Mon, 14 Dec 2009 15:33:07 +0100, "Michael Reim"
>>>>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>>>> wrote:
>>>>>>
>>>>>>>Hello,
>>>>>>>
>>>>>>>I'm struggling with enhanced metafiles.
>>>>>>>What I have is an enhanced metafile on disk, where I want to modify a
>>>>>>>comment.
>>>>>>>
>>>>>>>Here is how I try to do this (simplified):
>>>>>>> HENHMETAFILE hMetaFile = GetEnhMetaFile(TmpFileName);
>>>>>>> HDC hTargetDC = CreateEnhMetaFile(DC.m_hDC, NULL, &Bounds,
>>>>>>>_T("WinHCU\0tmp\0\0"));
>>>>>>> EnumEnhMetaFile(hTargetDC, hMetaFile,
>>>>>>> ProtoView_EnhMetaFileReplaceProc,
>>>>>>>NULL, &ZeichenRect);
>>>>>>> DeleteEnhMetaFile(hMetaFile);
>>>>>>> hMetaFile = CloseEnhMetaFile(hTargetDC);
>>>>>>> CopyEnhMetaFile(hMetaFile, TmpFileName2);
>>>>>>> CloseHandle(hMetaFile);
>>>>>>>
>>>>>>>My Callback function looks like this:
>>>>>>> int CALLBACK ProtoView_EnhMetaFileReplaceProc(
>>>>>>> __in HDC hDC,
>>>>>>> __in HANDLETABLE * lpHTable,
>>>>>>> __in const ENHMETARECORD *lpEMFR,
>>>>>>> __in int nObj,
>>>>>>> __in LPARAM lpData
>>>>>>> )
>>>>>>> {
>>>>>>> return PlayEnhMetaFileRecord(hDC, lpHTable, lpEMFR, nObj);
>>>>>>> }
>>>>>>>
>>>>>>>It's no problem for me to identify and modify the comment in the
>>>>>>>metafile.
>>>>>>>The problem is that the metafile increases from 6 records to 29
>>>>>>>records
>>>>>>>even
>>>>>>>if I don't modify anything.
>>>>>>>If I do this over and over again the number of records seems to
>>>>>>>double
>>>>>>>every
>>>>>>>time.
>>>>>>>The same result for PlayEnhMetaFile instead of EnumEnhMetaFile.
>>>>>>>
>>>>>>>So how can I play one metafile into a new one without increasing the
>>>>>>>number
>>>>>>>of records?
>>>>>>>
>>>>>>>Please see the attached two files for an example. bild1.emf is the
>>>>>>>original,
>>>>>>>bild2.emf is the increased file.
>>>>>>>
>>>>>>>TIA
>>>>>> Joseph M. Newcomer [MVP]
>>>>>> email: newcomer(a)flounder.com
>>>>>> Web: http://www.flounder.com
>>>>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>>>
>>>>>
>>>>>
>>>>
>>> Joseph M. Newcomer [MVP]
>>> email: newcomer(a)flounder.com
>>> Web: http://www.flounder.com
>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>
>>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>


From: Joseph M. Newcomer on
EnumMetaFile to read them should be sufficient.

I think the new records are being added when you play them back through the DC.

You can look at my Metafile Explorer to see what I did.
joe

On Wed, 16 Dec 2009 12:11:41 +0100, "Michael Reim"
<nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:

>
>I do this via EnumEnhMetaFile, because
>1. it is easy to use.
>2. in my real application I don't have a target file on disk, this was only
>to debug the problem. I forward the handle to the metafile to an edit
>control in order to show it.
>
>But your idea sounds interesting anyway.
>Do you know of a set of functions to read and write the metafile records
>directly?
>
>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>news:0eefi5tecu7f81r1he9bbtdf9ta177gsrj(a)4ax.com...
>> That's surprising, because 15 new records of the form shown should not
>> increase the file
>> significantly, and I would have assumed that because they were supplied if
>> absent, they
>> would not be supplied if present. But you'd have to post this someplace
>> like Microsoft
>> Connect to report it as a problem. I don't know any way to tell the
>> playback to not
>> supply them.
>>
>> What I'm seeing happen is that you are playing the metafile back through
>> another metafile
>> DC, and creating the new metafile through that DC. Instead of doing that,
>> why not just
>> read the metafile records, and write it out directly to a new file. When
>> you get to the
>> one you want to modify, modify it and write it out. You can play them
>> through a DC to do
>> the drawing, but it looks like playing them back through a DC is what is
>> causing the
>> problem.
>> joe
>> On Tue, 15 Dec 2009 15:33:59 +0100, "Michael Reim"
>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>>
>>>ok, and how can I prevent EnumEnhMetaFile from creating this implicit
>>>context?
>>>
>>>I'm storing my own data in a metafile comment. Which I want to modify each
>>>time, when the user clicks a button.
>>>At the moment this "implicit context" is getting larger with every
>>>modification. A 9 KB file grows to 5.3 MB after just 15 modifications.
>>>
>>>
>>>"Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>>news:op4fi5l8unjjthep9au21l1mjs3d3r0s6p(a)4ax.com...
>>>> As far as attachments, they mostly don't work in newsgroup posts. If
>>>> you
>>>> sent me private
>>>> email, however, my ISP has apparently installed new "security" software
>>>> which is nuking
>>>> messages with attachments; I'm trying to get that fixed.
>>>>
>>>> It looks like the act of playing the file is creating some implicit
>>>> context, such as the
>>>> selection of stock objects and the setting of transformations, which
>>>> gets
>>>> added during the
>>>> playback. These implicit contexts are then made part of your file.
>>>>
>>>> It is questionable why these are being added, but it appears to be part
>>>> of
>>>> the playback
>>>> mechanism. That's at least what it appears to be happening, given the
>>>> information I see
>>>> below.
>>>> joe
>>>>
>>>> On Tue, 15 Dec 2009 08:14:40 +0100, "Michael Reim"
>>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote:
>>>>
>>>>>Here are the records:
>>>>>E:\tmp\bild1.emf
>>>>>
>>>>> EMR_HEADER
>>>>>
>>>>> DWORD iType: 1
>>>>>
>>>>> DWORD nSize: 132
>>>>>
>>>>> RECTL rclBounds: {0, 0, 175, 175}
>>>>>
>>>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>>>
>>>>> DWORD dSignature: ' EMF'
>>>>>
>>>>> DWORD nVersion: 0x10000
>>>>>
>>>>> DWORD nBytes: 9596
>>>>>
>>>>> DWORD nRecords: 6
>>>>>
>>>>> WORD nHandles: 1
>>>>>
>>>>> WORD sReserved: 0
>>>>>
>>>>> DWORD nDescription: 12
>>>>>
>>>>> DWORD offDescription: 108
>>>>>
>>>>> [108] L"WinHCU"
>>>>>
>>>>> DWORD nPalEntries: 0
>>>>>
>>>>> SIZEL szlDevice: {1280, 1024}
>>>>>
>>>>> SIZEL szlMillimeters: {362, 290}
>>>>>
>>>>> DWORD cbPixelFormat: 0
>>>>>
>>>>> DWORD offPixelFormat: 0
>>>>>
>>>>> DWORD bOpenGL: 0
>>>>>
>>>>> SIZEL szlMicrometers: {362000, 290000}
>>>>>
>>>>> EMR_SETWINDOWORGEX
>>>>>
>>>>> POINTL ptlOrigin: {0, 0}
>>>>>
>>>>> EMR_SETWINDOWEXTEX
>>>>>
>>>>> SIZEL szlExtent: {176, 176}
>>>>>
>>>>> EMR_STRETCHBLT
>>>>>
>>>>> RECTL rclBounds: {0, 0, 175, 175}
>>>>>
>>>>> LONG xDest: 0
>>>>>
>>>>> LONG yDest: 0
>>>>>
>>>>> LONG cxDest: 176
>>>>>
>>>>> LONG cyDest: 176
>>>>>
>>>>> DWORD dwRop: SRCCOPY
>>>>>
>>>>> LONG xSrc: 0
>>>>>
>>>>> LONG ySrc: 0
>>>>>
>>>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>>>
>>>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>>>
>>>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>>>
>>>>> DWORD offBmiSrc: 108
>>>>>
>>>>> BITMAPINFOHEADER bmiHeader
>>>>>
>>>>> DWORD biSize: 40
>>>>>
>>>>> LONG biWidth: 48
>>>>>
>>>>> LONG biHeight: 48
>>>>>
>>>>> WORD biPlanes: 1
>>>>>
>>>>> WORD biBitCount: 32
>>>>>
>>>>> DWORD biCompression: BI_BITFIELDS
>>>>>
>>>>> DWORD biSizeImage: 9216
>>>>>
>>>>> LONG biXPelsPerMeter: 0
>>>>>
>>>>> LONG biYPelsPerMeter: 0
>>>>>
>>>>> DWORD biClrUsed: 0
>>>>>
>>>>> DWORD biClrImportant: 0
>>>>>
>>>>> RGBQUAD bmiColors[1]
>>>>>
>>>>> DWORD cbBmiSrc: 52
>>>>>
>>>>> DWORD offBitsSrc: 160
>>>>>
>>>>> DWORD cbBitsSrc: 9216
>>>>>
>>>>> LONG cxSrc: 48
>>>>>
>>>>> LONG cySrc: 48
>>>>>
>>>>> EMR_GDICOMMENT
>>>>>
>>>>> DWORD cbData: 24
>>>>>
>>>>> BYTE Data[1]
>>>>>
>>>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>>>> 34
>>>>>35 36 37
>>>>>
>>>>> ...G .... .e.. .... 0123 4567
>>>>>
>>>>> EMR_EOF
>>>>>
>>>>> DWORD nPalEntries: 0
>>>>>
>>>>> DWORD offPalEntries: 16
>>>>>
>>>>> DWORD nSizeLast: 20
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>E:\tmp\bild2.emf
>>>>>
>>>>> EMR_HEADER
>>>>>
>>>>> DWORD iType: 1
>>>>>
>>>>> DWORD nSize: 132
>>>>>
>>>>> RECTL rclBounds: {0, 0, 174, 174}
>>>>>
>>>>> RECTL rclFrame: {0.00mm, 0.00mm, 50.00mm, 50.00mm}
>>>>>
>>>>> DWORD dSignature: ' EMF'
>>>>>
>>>>> DWORD nVersion: 0x10000
>>>>>
>>>>> DWORD nBytes: 10012
>>>>>
>>>>> DWORD nRecords: 29
>>>>>
>>>>> WORD nHandles: 1
>>>>>
>>>>> WORD sReserved: 0
>>>>>
>>>>> DWORD nDescription: 12
>>>>>
>>>>> DWORD offDescription: 108
>>>>>
>>>>> [108] L"WinHCU"
>>>>>
>>>>> DWORD nPalEntries: 0
>>>>>
>>>>> SIZEL szlDevice: {1280, 1024}
>>>>>
>>>>> SIZEL szlMillimeters: {362, 290}
>>>>>
>>>>> DWORD cbPixelFormat: 0
>>>>>
>>>>> DWORD offPixelFormat: 0
>>>>>
>>>>> DWORD bOpenGL: 0
>>>>>
>>>>> SIZEL szlMicrometers: {362000, 290000}
>>>>>
>>>>> EMR_SAVEDC
>>>>>
>>>>> EMR_SETLAYOUT
>>>>>
>>>>> DWORD iMode: 0
>>>>>
>>>>> EMR_SETMETARGN
>>>>>
>>>>> EMR_SELECTOBJECT
>>>>>
>>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | WHITE_BRUSH
>>>>>
>>>>> EMR_SELECTOBJECT
>>>>>
>>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | BLACK_PEN
>>>>>
>>>>> EMR_SELECTOBJECT
>>>>>
>>>>> DWORD ihObject: ENHMETA_STOCK_OBJECT | DEVICE_DEFAULT_FONT
>>>>>
>>>>> EMR_SELECTPALETTE
>>>>>
>>>>> DWORD ihPal: ENHMETA_STOCK_OBJECT | DEFAULT_PALETTE
>>>>>
>>>>> EMR_SETBKCOLOR
>>>>>
>>>>> COLORREF crColor: RGB(255, 255, 255)
>>>>>
>>>>> EMR_SETTEXTCOLOR
>>>>>
>>>>> COLORREF crColor: RGB(0, 0, 0)
>>>>>
>>>>> EMR_SETBKMODE
>>>>>
>>>>> DWORD iMode: OPAQUE
>>>>>
>>>>> EMR_SETPOLYFILLMODE
>>>>>
>>>>> DWORD iMode: ALTERNATE
>>>>>
>>>>> EMR_SETROP2
>>>>>
>>>>> DWORD iMode: R2_COPYPEN
>>>>>
>>>>> EMR_SETSTRETCHBLTMODE
>>>>>
>>>>> DWORD iMode: STRETCH_ANDSCANS
>>>>>
>>>>> EMR_SETTEXTALIGN
>>>>>
>>>>> DWORD iMode: TA_TOP | TA_LEFT | TA_NOUPDATECP
>>>>>
>>>>> EMR_SETBRUSHORGEX
>>>>>
>>>>> POINTL ptlOrigin: {0, 0}
>>>>>
>>>>> EMR_SETMITERLIMIT
>>>>>
>>>>> FLOAT eMiterLimit: 1.4013e-044
>>>>>
>>>>> EMR_MOVETOEX
>>>>>
>>>>> POINTL ptl: {0, 0}
>>>>>
>>>>> EMR_SETWORLDTRANSFORM
>>>>>
>>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>>
>>>>> EMR_MODIFYWORLDTRANSFORM
>>>>>
>>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>>
>>>>> DWORD iMode: 4
>>>>>
>>>>> EMR_SETLAYOUT
>>>>>
>>>>> DWORD iMode: 0
>>>>>
>>>>> EMR_GDICOMMENT
>>>>>
>>>>> DWORD cbData: 52
>>>>>
>>>>> BYTE Data[1]
>>>>>
>>>>> 47 44 49 43 02 00 00 00 00 00 00 00 00 00 00 00 b1 00 00 00
>>>>> b1
>>>>>00 00 00 0c 00 00 00 57 00 69 00 6e 00 48 00 43 00 55 00 00 00 74
>>>>>00
>>>>>6d 00 70 00 00 00 00 00
>>>>>
>>>>> GDIC .... .... .... .... .... .... W.i. n.H. C.U. ..t. m.p.
>>>>> ....
>>>>>
>>>>> EMR_SETWORLDTRANSFORM
>>>>>
>>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>>
>>>>> EMR_MODIFYWORLDTRANSFORM
>>>>>
>>>>> XFORM xform: {0.9955, 0, 0, 0.996875, 0, 0}
>>>>>
>>>>> DWORD iMode: 4
>>>>>
>>>>> EMR_STRETCHBLT
>>>>>
>>>>> RECTL rclBounds: {0, 0, 174, 174}
>>>>>
>>>>> LONG xDest: 0
>>>>>
>>>>> LONG yDest: 0
>>>>>
>>>>> LONG cxDest: 176
>>>>>
>>>>> LONG cyDest: 176
>>>>>
>>>>> DWORD dwRop: SRCCOPY
>>>>>
>>>>> LONG xSrc: 0
>>>>>
>>>>> LONG ySrc: 0
>>>>>
>>>>> XFORM xformSrc: {1, 0, 0, 1, 0, 0}
>>>>>
>>>>> COLORREF crBkColorSrc: RGB(255, 255, 255)
>>>>>
>>>>> DWORD iUsageSrc: DIB_RGB_COLORS
>>>>>
>>>>> DWORD offBmiSrc: 108
>>>>>
>>>>> BITMAPINFOHEADER bmiHeader
>>>>>
>>>>> DWORD biSize: 40
>>>>>
>>>>> LONG biWidth: 48
>>>>>
>>>>> LONG biHeight: 48
>>>>>
>>>>> WORD biPlanes: 1
>>>>>
>>>>> WORD biBitCount: 32
>>>>>
>>>>> DWORD biCompression: BI_BITFIELDS
>>>>>
>>>>> DWORD biSizeImage: 9216
>>>>>
>>>>> LONG biXPelsPerMeter: 0
>>>>>
>>>>> LONG biYPelsPerMeter: 0
>>>>>
>>>>> DWORD biClrUsed: 0
>>>>>
>>>>> DWORD biClrImportant: 0
>>>>>
>>>>> RGBQUAD bmiColors[1]
>>>>>
>>>>> DWORD cbBmiSrc: 52
>>>>>
>>>>> DWORD offBitsSrc: 160
>>>>>
>>>>> DWORD cbBitsSrc: 9216
>>>>>
>>>>> LONG cxSrc: 48
>>>>>
>>>>> LONG cySrc: 48
>>>>>
>>>>> EMR_GDICOMMENT
>>>>>
>>>>> DWORD cbData: 24
>>>>>
>>>>> BYTE Data[1]
>>>>>
>>>>> 15 08 11 47 01 00 00 00 a5 65 00 00 18 00 00 00 30 31 32 33
>>>>> 34
>>>>>35 36 37
>>>>>
>>>>> ...G .... .e.. .... 0123 4567
>>>>>
>>>>> EMR_GDICOMMENT
>>>>>
>>>>> DWORD cbData: 8
>>>>>
>>>>> BYTE Data[1]
>>>>>
>>>>> 47 44 49 43 03 00 00 00
>>>>>
>>>>> GDIC ....
>>>>>
>>>>> EMR_RESTOREDC
>>>>>
>>>>> LONG iRelative: -1
>>>>>
>>>>> EMR_EOF
>>>>>
>>>>> DWORD nPalEntries: 0
>>>>>
>>>>> DWORD offPalEntries: 16
>>>>>
>>>>> DWORD nSizeLast: 20
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>"Michael Reim"
>>>>><nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>>>schrieb
>>>>>im
>>>>>Newsbeitrag news:uOeEpSVfKHA.5608(a)TK2MSFTNGP05.phx.gbl...
>>>>>> Hello Joe,
>>>>>>
>>>>>> can't you open my attachments?
>>>>>>
>>>>>> I'll try to find your "Metafile Explorer" at the moment I'm using
>>>>>> another
>>>>>> tool, but this is a bit tricky to copy these records into a text file.
>>>>>>
>>>>>> "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag
>>>>>> news:t3tci5t3mef55s9gbnvvu8g6j6gbo4n818(a)4ax.com...
>>>>>>> It would help if you knew what the new records were. Consider using
>>>>>>> my
>>>>>>> "Metafile
>>>>>>> Explorer" which you can download from my MVP Tips site. Also, in my
>>>>>>> MSDN
>>>>>>> Errors and
>>>>>>> Omissions, I have detailed documentation of the metafile records.
>>>>>>> joe
>>>>>>>
>>>>>>> On Mon, 14 Dec 2009 15:33:07 +0100, "Michael Reim"
>>>>>>> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>Hello,
>>>>>>>>
>>>>>>>>I'm struggling with enhanced metafiles.
>>>>>>>>What I have is an enhanced metafile on disk, where I want to modify a
>>>>>>>>comment.
>>>>>>>>
>>>>>>>>Here is how I try to do this (simplified):
>>>>>>>> HENHMETAFILE hMetaFile = GetEnhMetaFile(TmpFileName);
>>>>>>>> HDC hTargetDC = CreateEnhMetaFile(DC.m_hDC, NULL, &Bounds,
>>>>>>>>_T("WinHCU\0tmp\0\0"));
>>>>>>>> EnumEnhMetaFile(hTargetDC, hMetaFile,
>>>>>>>> ProtoView_EnhMetaFileReplaceProc,
>>>>>>>>NULL, &ZeichenRect);
>>>>>>>> DeleteEnhMetaFile(hMetaFile);
>>>>>>>> hMetaFile = CloseEnhMetaFile(hTargetDC);
>>>>>>>> CopyEnhMetaFile(hMetaFile, TmpFileName2);
>>>>>>>> CloseHandle(hMetaFile);
>>>>>>>>
>>>>>>>>My Callback function looks like this:
>>>>>>>> int CALLBACK ProtoView_EnhMetaFileReplaceProc(
>>>>>>>> __in HDC hDC,
>>>>>>>> __in HANDLETABLE * lpHTable,
>>>>>>>> __in const ENHMETARECORD *lpEMFR,
>>>>>>>> __in int nObj,
>>>>>>>> __in LPARAM lpData
>>>>>>>> )
>>>>>>>> {
>>>>>>>> return PlayEnhMetaFileRecord(hDC, lpHTable, lpEMFR, nObj);
>>>>>>>> }
>>>>>>>>
>>>>>>>>It's no problem for me to identify and modify the comment in the
>>>>>>>>metafile.
>>>>>>>>The problem is that the metafile increases from 6 records to 29
>>>>>>>>records
>>>>>>>>even
>>>>>>>>if I don't modify anything.
>>>>>>>>If I do this over and over again the number of records seems to
>>>>>>>>double
>>>>>>>>every
>>>>>>>>time.
>>>>>>>>The same result for PlayEnhMetaFile instead of EnumEnhMetaFile.
>>>>>>>>
>>>>>>>>So how can I play one metafile into a new one without increasing the
>>>>>>>>number
>>>>>>>>of records?
>>>>>>>>
>>>>>>>>Please see the attached two files for an example. bild1.emf is the
>>>>>>>>original,
>>>>>>>>bild2.emf is the increased file.
>>>>>>>>
>>>>>>>>TIA
>>>>>>> Joseph M. Newcomer [MVP]
>>>>>>> email: newcomer(a)flounder.com
>>>>>>> Web: http://www.flounder.com
>>>>>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>> Joseph M. Newcomer [MVP]
>>>> email: newcomer(a)flounder.com
>>>> Web: http://www.flounder.com
>>>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>>>
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>>
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm