Re: Closing Enh Metafile device contex
- From: "Paul Baker [MVP, Windows - SDK]" <paulrichardbaker@xxxxxxxxxxxxxxxx>
- Date: Thu, 6 Mar 2008 15:40:43 -0500
This post has confirmation from Microsoft that you should not be calling
DeleteDC on a metafile DC. So when you're done, call CloseEnhMetaFile and
DeleteEnhMetaFile. If CloseEnhMetaFile fails, there's nothing else you can
do.
http://groups.google.com/group/microsoft.public.win32.programmer.gdi/browse_thread/thread/cc416b159911486c/2b19177e8b3c2e7e
Paul
"Paul Baker [MVP, Windows - SDK]" <paulrichardbaker@xxxxxxxxxxxxxxxx> wrote
in message news:%23mNF7l8fIHA.5180@xxxxxxxxxxxxxxxxxxxxxxx
I am going to refer you to the documentation, but it is not as clear as it
should be:
Metafile Functions:
http://msdn2.microsoft.com/en-us/library/ms534278.aspx
CreateEnhMetaFile returns an HDC and DeleteEnhMetaFile wants an
ENHMETAFILE, so you can't do that.
You want to call CloseEnhMetaFile to convert your HDC to an ENHMETAFILE.
I don't know what you're supposed to do if CreateEnhMetaFile succeeds and
CloseEnhMetaFile fails! Call DeleteDC perhaps?
Paul
"Gary Larimer" <GaryLarimer@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A05A1F75-D111-4DE7-89EE-8168116899B7@xxxxxxxxxxxxxxxx
How can an enhanced metafile context handle, hDC, be closed without
invoking
CloseEnhMetaFile(hDC) first?
The metafile context handle, hDC, was created as:
hDC = CreateEnhMetaFile(NULL, NULL, NULL, NULL)
Is it OK to do this,
iret = DeleteEnhMetaFile(hDC)
The reason I ask has to do with error handling. If hDC is created an an
error occurs in subsequent code, before CloseEnhMetaFile(hDC) is reached,
I
would like to just close hDC and return.
Thanks for any comments\information.
--
Gary Larimer
.
- Follow-Ups:
- Re: Closing Enh Metafile device contex
- From: Gary Larimer
- Re: Closing Enh Metafile device contex
- References:
- Re: Closing Enh Metafile device contex
- From: Paul Baker [MVP, Windows - SDK]
- Re: Closing Enh Metafile device contex
- Prev by Date: Re: Closing Enh Metafile device contex
- Next by Date: Re: how GDI+ process parameters of REAL type
- Previous by thread: Re: Closing Enh Metafile device contex
- Next by thread: Re: Closing Enh Metafile device contex
- Index(es):
Relevant Pages
|