From: AliR on
Are you using a different filename each time, or reusing the filename? Do
TempFileName, and TempFileName2 have the same filename?

AliR.

"Michael Reim"
<nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in
message news:OKIYcpMfKHA.6000(a)TK2MSFTNGP06.phx.gbl...
> 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
> --
> Michael Reim
> Michael DOT Reim AT helmut-fischer DOT de
>
>
>


From: Joseph M. Newcomer on
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
From: Michael Reim on
I'm using different filenames each time.

TempFileName and TempFileName2 are different.

"AliR" <AliR(a)online.nospam> schrieb im Newsbeitrag
news:ef5ROiNfKHA.5568(a)TK2MSFTNGP02.phx.gbl...
> Are you using a different filename each time, or reusing the filename? Do
> TempFileName, and TempFileName2 have the same filename?
>
> AliR.
>
> "Michael Reim"
> <nospammichaelDOTreim(a)REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in
> message news:OKIYcpMfKHA.6000(a)TK2MSFTNGP06.phx.gbl...
>> 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
>> --
>> Michael Reim
>> Michael DOT Reim AT helmut-fischer DOT de
>>
>>
>>
>
>
>


From: Michael Reim on
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


From: Michael Reim on
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
>
>
>