I'm using different filenames each time.
TempFileName and TempFileName2 are different.
Are you using a different filename each time, or reusing the filename? Do
TempFileName, and TempFileName2 have the same filename?
AliR.
"Michael Reim"
<nospammichaelDOTreim@REMOVENOSPAMANDCAPShelmut-fischer.denospam> wrote in
message news:OKIYcpMfKHA.6000@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